How to handle a window control in Selenium - selenium

I'm currently automating an application using selenium ,and when a button is clicked a new pop up window appears.I have to switch to that window..its like a form in which I have to fill the persons name, city etc
I am new to selenium..so any help would be appreciated.

After click, popup window appears..... now
1. use Firebug to inspect fields(username) are available in Form
if you are able to inspect, then no need to move control to window etc task
Just find the object path and do Actions on each fields in form.
Basically it is Hidden division popup window.

If a new pop-up window is shown and you want to perform actions in the new window, you have to first switch to the frame/window.
Use driver.switchTo().frame(1)
or Use driver.switchTo().frame("dropboxIframe") [Example switching to dropbox window]
You will have to know the name of the frame, which you can find using inspect element.
Also after switching to different window, always provide some Thread.sleep for few seconds for that page to load.
Once you are done with work on pop-up window and want to come back to default frame, use this:
driver.switchTo().defaultContent()

As #Bravana AS said, you need to switch to a frame:
If you have only a new frame, this one will be '1', your previous page is '0', so, use:
driver.switchTo().frame("1");
you can pass INDEX and ID to frame()
to back to your previous page:
driver.switchTo().defaultContent();
OR
driver.switchTo().frame("0");

Related

How to handle modal/ pop-up using automation

Tried to handle the pop-up many ways, need clarity do we need to change the body. because when the pop-up is displayed the new class is adding it is as below.
https://i.stack.imgur.com/jQC2B.png
The actual Pop-up class is as below. there is no close button for this pop-up.
https://i.stack.imgur.com/e1ZWc.png
-By manual user can close the pop-up when user click any where in the page. When i tried click any where using automation it is displaying as element not found
Here is the code i user to handle the pop-up i am so confused how to handle the pop-up
https://i.stack.imgur.com/ibf0j.png
Thanks for help in advance
please try to check the javascript from where this pop-up is executing and try to disable display property by setting it to none
Try to remove this div class name "_355Q0" from DOM. by using this javascript query.
var myobj = document.querySelector("._355Q0")
myobj.remove();

Using puppeteer to automate button clicks for every button at every URL in a web app

I am currently trying to use JS and puppeteer to take a screenshot of every url in my web app, as well as take a screenshot of every button that can be clicked. Is there a way to click each button without specifying the id? Not all of my buttons have an id and even if they did, I wouldn't want to have x number of page.click(id, options) for each button I have (which is quite a lot).
Thanks
I have tried going based off each className (this app is built using react) but this does not work. It will take a screenshot of the same buttons over and over. I believe because if page.click has multiple of the same options, it only chooses the first one and many buttons have the same styling classNames.
You could get an array of each element on a page, go through the elements with a for loop determine if it is a button, then click it. Then for each page you'd have to input each url in an array and then use a for loop to go through it.

Can not click on element via TestComplete object mapping

I need to click on a web element, within TestComplete, this element looks like this:
I outlined its boundary using heavy-black line.
The problem is, by default, an element is always clicked in its middle point, and for this element above, clicking its middle point produces no results as it does not click this plus sign.
Within TestComplete, this element can not be broken further down into smaller elements.
I can use Selenium in JavaScript to click it, but is there is an other way?
Thanks
Try using x and y coordinates with the Click method.
SmartBear Click Action
I needed to click a button on my website but TestComplete was only able to identify the parent object which had 3 buttons in it. I was able to use x,y coordinates to press the 3 different buttons in parent object.
Record a script where you click the button and look at the function created to get the coordinates you need.

Modal dialog box disable main window

I'm open a modal dialog box using the next code:
call screen 0010 starting at 15 1.
However it disables the main window to continue working.
It's posible to call a modal dialog box and enable the main window to work while it's opened?
The very nature of a modal window is that it blocks the application until it is closed. The opposite would be an amodal dialog, and no, you can't have an amodal modal window. What you can do:
CALL FUNCTION 'Z_FUNCTION_WITH_DIALOG' STARTING NEW TASK 'FOOBAR' - this will start an additional external session (as long as the user has not exceeded the session limit).
Use the class CL_DGUI_DIALOGBOX_CONTAINER to produce an amodal window. Be aware that you can't use screens (dynpros) inside this container. Check the report RSDEMO_DIALOGBOX_CONTROL for some example coding.

How to create test cases result or any new item in Rally app

I have a custom app report that shows test cases not run for test set. I need to have a button/link upon clicking of which I can enter a test case result. So far the code that I have is opening up the correct test case result window but upon clicking Save it hangs. When I checked the console output for this hanging window it showed that session was unknown. So the question is can this be achieved with custom generated link and pass the session somehow or the approach should be entirely different. Currently I am using 2.0.p5
Here's an app that uses Rally.nav.Manager.create to instantiate a TestCaseResult editor in response to a button click from a grid cell, in turn based on this answer: How to add a custom button on grid and pass row values?
https://github.com/markwilliams970/TestCaseGrid-AddResults