i'm new to selenium so i don't know weather to ask this question or not please correct me if im wrong ..
i have a site where clicking a button opens the link in a new tab i have succefull used the selenium windowhandle and done the work on the new open tab but when switching to the parent tab i have a problem that is the code is being executed in that parent tab but the tab is not being focused so i can't see how my code is being executed in parent window for that i know to press Crlt +1 using java robot but is there any other way of haveing the focus back to my parent window so that i can see what is happening...
Thanks in Advance
This is what I use:
webDriver.switchTo().window(webDriver.getWindowHandles().toArray()[0])
To bring the window to front of all the windows I think you can try this.
webdriver .manage().window().maximize();
Related
When we use JAWs for accessibility purpose we find an issue with Tab button. It's work correct for IE browser, but wrong for Edge. When SWT Edge browser widget display and we use Tab button JAWs pronounce wrong Link/Button label, (it repeat the previous one, but if we click Enter right link will open).The issue is random, sometimes it's work correct but sometimes simply repeat the previous Link title/label. It's work ok if I use U button but wrong for Tab. I've tested browser's part locally running it at Edge browser and found that Tab button work correct with JAWs. But when I run application as a part of Eclipse RCP application with SWT Edge browser I found an error. It seems like we have some conflict/problem between SWT Edge and Jaws. May be some one understand the problem and can help with it? Thank you
I used the following command to minimize chrome browser:
driver.manage().window().setPosition(new Point(0,-1000));
But later when I clicked on chrome browser in toolbar to maximize, its not maximizing.
Can anybody help on this one please, why its not working?
The reason is that the command you're using doesn't Minimize the window, it moves its position off screen. So when you're clicking in the toolbar it will be minimizing/maximizing as you click, but you just can't see it.
If you wish to make the window visible again later in your code you can just reset the window position with
driver.manage().window().setPosition(new Point(0,0))
I want to click on flash button which should open a new tab and in turn I need to do some operations on that page and return to the main page. Can anyone help with the code in Java? I have seen that flash doesn't work on Selenium, if so what are the alternatives?
I never tried, but i found this link, http://www.adobe.com/devnet/flash/articles/flash_selenium.html, maybe is useful for you. Is a plugin to use selenium in Flash front end
I am using Selenium Webdriver with Java. I have an issue: when I click on menu button, the menu control is notfound in safari browser. How do I solve it?
For this problem you have to use short cuts.
For example you need to open FILE menu then you have a short cut "ALT+F"
You can do this with Actions class in Selenium web driver.
Example:
new Actions(driver)
.keyDown(Keys.ALT)
.sendKeys("F")
.keyUp(Keys.ALT)
.perform();
Here I have use ALT + F key to open menu.
Your problem is solve easily by this code.
===============================================================
Note : If there is bug or defect in Safari Menu then This will not work properly. So please check it manually first then apply automation on that.Save time. :)
In my web appilcation, i need to click on the cancel button of the print preview window of chrome that comes up. I found some code in web to switch between the windows, but for some reason, it doesnt seem to be working. please help.
driver.findElement(By.xpath("//*[#id='PrintBill']")).click();
driver.findElement(By.xpath("//*[#id='savebill']")).click();
// This is in the parent window.
for(String winHandle : driver.getWindowHandles()){
driver.switchTo().window(winHandle);
}
driver.findElement(By.xpath("//*[#id='print-header']/div/button[2]")).click();
//this is in the child window(print preview window)
This is where i found the code from... http://seleniumwebdriverfaq.blogspot.in/2012/02/how-can-i-switch-webdriver-control-to_4426.html
It looks like the problem is that Chrome print page is not just another browser window but a modal dialog box which means Selenium probably can not interact with it. So what you can do instead is to use Robots. Here is an example solution for your issue. Go straight down to post #11:
Handling the print dialog box
I quickly checked it on a sample page and it works fine.