Tooltip covers the button so I get org.openqa.selenium.ElementClickInterceptedException - selenium

I'm using Selenium for integration testing of our web app, and it's been working great up until I got far enough down the sidebar menu. Suddently the Create test would fail with org.openqa.selenium.ElementClickInterceptedException: element click intercepted. Other element would receive the click:
The error was very sporadic - order of tests would affect which test class failed - but finally I figured out the reason is that the tooltip from the most recently clicked menu option covers the button I'm trying to click. Not really sure why sending input to form elements (using WebElement:sendKeys() and org.openqa.selenium.support.ui.Select) does not count as moving the mouse away.
Is there a way to make Selenium work around this, or do we have to turn off tooltips in the test version (for obvious reasons I don't like the idea of running our tests on a custom version of the web app)?

Related

Click not working on combo-box down arrow button karate UI testing

I tried clicking on down arrow button for a Combo Box (Select is not available. Its a React JS application and once I click on arrow button only list shows selection items) using below karate command but click not happened in application and no error displayed. [The same xpath worked in selenium click command,and showing unique item on Inspect search]
And waitFor("//div[#id='root']/div/div[3]/main/div/div[3]/div[2]/div")
And click("//div[#id='root']/div/div[3]/main/div/div[3]/div[2]/div")
Note: Then I tried below command
And assert('//div[#id='root']/div/div[3]/main/div/div[3]/div[2]/div').exists
and got error
javascript evaluation failed: assert('//div[#id='root']/div/div[3]/main/div/div[3]/div[2]/div').exists, :1:19 Expected , but found root
assert('//div[#id='root']/div/div[3]/main/div/div[3]/div[2]/div').exists
It would really help us if you follow this process, it is simple and should not take much time for you to give us a small snippet of static HTML (or you can mix react if really needed).
https://github.com/intuit/karate/tree/master/examples/ui-test
EDIT: you also seem to have mis-matched single and double-quotes in your code.
Also note that you should be able to fire a JS event or click by using the script() API. See this example: https://github.com/intuit/karate/tree/master/karate-core#script
So this is an alternate approach to be able to overcome any tricky situation that comes up.

How can I fix a button that is clicked but does not perform any actions?

So I'm currently working on a new project and I need to write some automated tests.
I came across a problem and I don't know how to fix it. If the button of my web page is clicked running selenium it doesn't perform any actions, but if I open the web page manualy and click on the button, everything works fine.
NOTE: I'm completely sure that the xpath is correct and the button is being clicked...
This is what happens running with selenium:
And this is what happens openning the web page manually and clicking on the button:

Selenium not found element while page is opening in small screen

For our web application I wrote one selenium script, which is working very fine in my office workstation (which has big screen).
When I execute the same script for the same application in my laptop(which has small screen) it is not able to find the element.
Actually when I open the application in my laptop some elements are visible only when I scroll down the page but those element are visible in big screen without scrolling. Application view is automatically adjust as per the screen.
So, for these application how I can write the selenium script so that it will work any kind of screen ?
What do you mean by "it is not able to find the element"? Which error did it show?
In my own experience with automation, in some specific scenarios, the behavior of the app change when the scrollbar appears (for example, when I try to click on an element, it scrolls down to that element, but "jumps up" to the element above it - this I can reproduce manually.)
Some test scenarios are quite sensitive with scrollbar, for example drag&drop.
You should analyse each failed test separately and find a solution for each case.
Selenium cannot find element that is not visible, you must always check if element is visible and if not scroll to this element.
see this question Scroll Element into View with Selenium

Selenium element.click() does not work

Hello: I am using Selenium/Java to grab a PDF from a website. The website does not generate them in advance, but only after I clink on a link. When I do, the web server goes away for a few minutes, and then comes back with the content.
I'm using Firefox, and its built-in PDF viewer. When I click on the download link from the main browser window, it opens another window to receive the PDF content. In a few minutes the child window is filled with the PDF content, and all I need to do is click a download button on the Firefox toolbar, and then press a Save button on the confimration dialog. I have done both of these things, successfully, sometimes.
My problem, sometimes occurs when I execute the code to click on the child window's download button...
WebElement element = driver.findElement(By.id("download"));
element.click();
Sometimes, it just doesn't work. The statement:
driver.findElement(By.id("download"))
...never throws an exception, so it appears to always be successful. Yet, the subsequent element.click() will often not produce the expected results.
I've thrown about 100 darts at this problem, but I can't seem to find one that produces consistent results. I've tried introducing delays, calling findElement several times, trying to use the driver on the child window in ways to confirm its connection to that window (all with positive return values), but nothing seems to help make element.click() on the darn download link successfull.
I have found Selenium to be a rock-solid solution, especially when working through the primary window...it never misses a beat, and I'm really quite impressed about that behavior. This is my first Selenium project, and I hoping someone that has used it a bit more, might have a suggestion for this particular problem.
It's hard to answer this question without additional information about how the child window is populated. If the child window is using javascript to add the button to the page and define its behavior (which is likely), then the element could be actually present on the page when you look for it (i.e. no error will be thrown), but it might not be active yet or prepared to be clicked.
It might be a good idea to look at the element definition in the source for the child page to get a better idea of how the button is coded. If you have access to the web developers who designed/implemented the button even better. If you can wait to perform the click action until the button is in the desired state, this should solve the problem.
Additionally if the page is coded using a dynamic framework like Angular, you might be better off using Protractor for testing, which is based off of Selenium, but which is aware of updates in the view as they are occurring.

Move target out of bounds exception

I am writing tests for a web application and all went well until I had to choose an option from a menu and that option displays a drop down list when hovered or clicked. When I click an option from the drop down list, I get the following error:
MoveTargetOutOfBoundsException: Element cannot be scrolled into view
Does anyone know what this error is about and what I should look for in my code?
Selenium version 2.25.0, java version 1.6.0_31
I've been checking some selenium and google groups regarding this issue in older versions https://groups.google.com/forum/?fromgroups=#!topic/selenium-users/EuZ7a6_lB9Q
http://code.google.com/p/selenium/issues/detail?id=3075
http://code.google.com/p/selenium/issues/detail?id=4102
a more recent discussion
Is it a known issue for Selenium 2.25.0 or is there a way to fix it? I recently upgraded to Firefox 15.0 :|
Note: I found a temporary solution until someone magically fixes this...since I can't find where the problem is...
I run the code before that point where it crashes, I put it to sleep for 10 seconds, I manually click the menu and the option from the drop down list, the window I want is displayed and the code continues with actions from that point. It works for now...I hope this will be fixed since I can't believe that I can run a script in Selenium IDE but I can't run my java code in WebDriver ...this is crazy :|
I guess you are trying to click an element from a dropdown.
You should keep in mind, that Selenium helps you replicate exact human behavior. So if the code fails because the element is not visible, it is probably because the element is not visible.
To make it work, you might want to put a click command on the menu before the failing bit of code.
(to replicate the sleep 10 seconds manually click the menu button method you are using)
Once again, if you can show us your code and also the HTML snippet of the Menu section, we can provide an exact solution.
Maybe you're opening new popup window while opening select box.
This may help you:
WebDriver.FindElement(By.Id("someInputBox")).SendKeys("hello");
(IJavaScriptExecutor)WebDriver).ExecuteScript("document.getElementById('windowOpener_Button').click();");
WebDriver.SwitchTo().Window("newDisplayedWindowPopupName"); // continue to test