I am facing the following issue please Help me:
When using my computer at the same time the tests are running in
the background - it is very easy to make a test fail that would
otherwise have passed. The easiest way to duplicate this is during
sendKeys - when text is appearing in a text box - if I click on the
browser title bar and hold and/or drag the window or try to work on eclipse at the same time - it is easy to
break a test.
I am using IE 7, Windows XP SP3.
Regards,
Gorav
Related
In macOS, when you set the chromedriver to headless, google chrome helper will pop up an annoying
window
If you close the window, the program will break, if you choose always allow, it will also break, the only way is to let it sit and do nothing while the program is working behind it until it finishes and you're allowed to close this window.
This is so annoying, I want to publish my program and I don't want my mac users to get disturbed by this.
Use another headless browser instead
nope. No can't do, HTMLUnitDriver javascript engine is useless. PhantomJS and JBrowser? Obsolete, no Java 11 support.
The window only shows when the chromedriver is headless and on the macOS.
I am using Selenium script (in Java) with Jenkins using Chrome browser.
But Jenkins opens Chrome browser with dimension 1040x784, although I tried to increase dimension as desktop browser but failed, it still opens browser with dimensions 1040x784.
I am using this code to increase dimension:
Dimension dim=new Dimension(1340, 744);
driver.manage().window().setSize(dim);
So in order to open chrome browser with desktop dimension, do I need to add any plugin? Due to this I am not able to automate most of the features with Jenkins.
* I am using Jenkins as my Windows services.
I use the same code as you with jenkins without problem: windows is set to its new size as expected.
I think the issue might be that Chrome does not allow to set the size larger than the dimension of the system's screen.
If you know for sure that your system's screen allows you to reach [1340, 744], then it might be because your chrome driver is not an up to date version.
If it still does not work, below are some tests you might try, to fix the issue:
Try to run it with firefox webdriver, and see if you have the same issue. this will discard an issue related to chrome webdriver.
Try to set new dimension, but smaller than the 1040, 784, and see if chrome lets you do that. It will discard an issue related to the way you have written your code.
does it work fine when you execute it on local ?
I have written the Selenium webdriver java code to automate the test and its working fine. But I have lot of data input to test my web and it takes time. So when i minimize the IE to do some other task while it is running the automation, it is throwing error:
org.openqa.selenium.ElementNotVisibleException: Element is not displayed
Selenium WebDriver is trying to simulate "real" users interaction with the webpage. If a person can't click on a button not currently displayed, neither can Selenium.
ElementNotVisibleException occurs when the element you want to interact with is not displayed. When you minimize the browser some of the elements are no longer visible, even though they where in maximized window.
You can add scroll using moveToElement() from Actions class every time you want to perform any action (I don't recommend it, you increase significantly the chance for errors), or find another hardware solution, like plugging in another screen, run the test on another computer etc.
According to my experience, the Internet Explorer WebDriver is very oversensitive when it comes to disturbances from a real user while running test cases. It's better to not touch anything at all. ;-)
Try Chrome! This is much more robust and also faster.
Selenium script runs as a simulator. You cannot do another work when script is running. Chrome is fast but while running script in chrome you can not do other task like any other browser. If you minimize window, you will get exception "ElementNotVisible".
I'm currently running my selenium webdriver tests in 2 browsers (studentdriver and tutordriver)
studentdriver = new ChromeDriver();# opening student in chrome browser
tutordriver = new FrefoxDriver();#opening tutor with firefox browser
and I'm student browser first and then tutorbrowser soth that student browser will be behind and tutorbrowser will be on front side. when script running with studentbrowser, it will automatically comes fron and tutorbrowser will be back side but when script start running using tutorbrowser it is not coming front side and it is creating some problem in between.
I need a solution to get tutorbrowser front when script start running on tutorbrowser.
Note: I should not close studentbrowser because I'm closing both the browsers in #After
((JavascriptExecutor) driver).executeScript("window.focus();");
try this with each driver.
Unfortunatly, this is an OS problem. It's up to the window manager to handle the ovelapping, tiling, organisation of the windows, which you can't control directly from your code.
The best bet you'll have is to launch a Sikuli Robot with which you'll be able to bring back the correct window. It's a bit of work, though, to include in your tests, but it can be used from Java with no problem
See the beast at http://www.sikuli.org
I have a simple CSS-based dropdown menu, and I'm trying to click on one of the menu items in a Java Selenium (WebDriver) test.
Both the menu (<ul> element) and the items (<a>) have IDs and creating corresponding WebElement objects works fine. I'm trying to click on one of the items with code like:
hoverOver(transfersMenu);
transferLink.click();
In hoverOver(), I've tried all three answers from this question, but none of them work. I keep getting:
org.openqa.selenium.ElementNotVisibleException:
Element is not currently visible and so may not be interacted with
Command duration or timeout: 2.06 seconds
(I've tried calling transferLink.click() also before hoverOver(), in the hope that the implicit wait would make it work, but nope.)
Any idea how to make the hovering work so that the link can be clicked?
Selenium version 2.21.0. I'm running the tests on Linux (Ubuntu), using Firefox 13.0. A colleague just tried on Windows (using Firefox 12.0), and it didn't work for him either.
Update: As per Slanec's tip in comments, and these instructions, I tried setEnableNativeEvents(true) on the FirefoxProfile. At first this failed:
org.openqa.selenium.InvalidElementStateException:
Cannot perform native interaction: Could not load native events component.
...but after I upgraded to Selenium 2.23.1, I no longer get that complaint.
Still, the hovering doesn't work (with native events on or off). :-/
I use the following code to hover over our menus for 1 second, before clicking a link, just like the one you are using:
action = new SeleniumActionHelper(driver);
WebElement currentUser = findElementByLinkText("testing1");
action.mouseHover(currentUser);
Thread.sleep(1000);
Of note, the mouse cursor needs to remain in the browser window for the hover to keep. If the mouse cursor is outside of the browser window, I experience a quick flash of the menu, but it does not stay visible
Try this exampale:
WebElement menuHoverLink= driver.findElement(By.id("test"));
actions.moveToElement(menuHoverLink).perform();
driver.findElement(By.id("test")).click();
Thread.sleep(6000);
How do you run your test classes? I found out that running WebDriver through ANT makes hover actions impossible, whereas running the test classes from command line (TestNG JAR) or from Eclipse works just fine.