How to find xpath in a new window handle - selenium

My site has a button that opens a new window handle.
I recognize the new window handle and switch to it.
when I try to inspect elements on this new handle I must press F12 and the DevTools open in a new window.
I enter my xpath and it highlights the object correctly.
when I search the object in my code it does not find it, and it seems that the HTML is not complete.
Any ideas?

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();

How to handle a window control in 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");

Not able to click on a button in a new window

I trigger a click on a button which then opens another window (which is neither a new browser nor a frame).
In the new window I wish to click a button but my code is not triggering the click.
I tried to switch to keyword matching but it is still not working.
My code:
driver.findElement(By.xpath("//span[text()='Continue to General Information']")).click();
…which I am sure is not correct to click the button in the new window.
What syntax should I use to click the button?
You can try something like this:
driver.SwitchTo().Window(driver.WindowHandles.Last());
I found it here. There is bit of an explanation of how it works there.

MS Access Form with Webbrowser Control Popup New IE Window, Access 2010/VBA

I have struck with one issue not finding any workable solution. Googled a lot without any success…HELP PLEASE.
Situation: Using MS Access 2010, there is one Form with WebBrowser Control (Unbound) for conducting some search, when I click the results of the search a Pop-up new Internet Explorer window opens for the search result.
Requirement: I need “new Internet Explorer window” needs to be opened on existing WebBrowser Control..... NOT to open separately as new pop-up Internet Explorer window.
Kindly provide me solution (MS Access 2010/VBA) or workaround….
Regards,
Sandy
Can you open the form that you are opening in the WebBrowser Control in a new browser window outside of the application in order to test something. Check to see, if when you open the url, and then invoke the search, if the results open in a new window for that browser. If so, then check the target of the form within the first screen to get the name of the window that the page is trying to open the results in. If the target is specified, then you will need to write code to remove it when the page loads.
Just assign the new web address to your webbrowser control. something like this. Note it has to include equal sign and a hyper-link surrounded by quote.
Private Sub WebBrowser34_Click()
Me.WebBrowser34.ControlSource = "='www.google.co.uk'"
End Sub

C# webbrowser control: page opens new window but it won't work

I use a webbrowser control (in C# - latest version of visual studio and .NET) to allow me to read and write data to a specific web page. Everything is OK until I reach the point that the page attempts to open a pdf document in a new window (the page contains javascript code).
The new window opens OK on my IE. But nothing appears when the webbrowser control opens the new window...
I've tried setting firefox as my default browser to see if it makes any difference but no good came out of it. The webbrowser control still opened IE.
I've tried catching the event of the new window and refer the url to another webbrowser control... no success again!
How can I get the pdf document? And why would the new window open but not display the pdf?