"element click intercepted" only on TFS - selenium

I have about 130 Selenium UI tests for a web app we're currently developing.
The problem I have is, whenever I run the tests locally through Visual Studio's test explorer (vstest), I have never encountered this error before.
The problem is, some of the tests keep failing due to this message when the tests are run on TFS (using vstest on TFS too). element click intercepted
I'm also 100% sure there is no overlaying element that interferes with the click method as the tests never fail with that message when run locally.
Any idea what could this be?

I had issues where all of my local tests would pass, but I would receive random errors as you mentioned when running the tests through Jenkins or TFS, usually errors indicating that my elements were not clickable, etc. - the issue ended up being the browser size.
I started running my test in headless mode and specified a large browser size. Switching to --headless and setting a browser size ended up solving most of my issues for me:
var headlessOptions = new ChromeOptions();
headlessOptions.AddArgument("--headless");
headlessOptions.AddArguments("--disable-gpu");
headlessOptions.AddArguments("--window-size=1920,1200");
You will have to use --headless for this to work too. I tried to run my tests by ONLY setting window size, but the tests would still fail anyway because the resolution of the virtual machines was not large enough to handle the browser size I had set.

You can resolve this issue by using 2 methods.
1.Running chrome in headless mode
2.Scorlling to the element before clicking or interacting with it
The root cause of this issue is due to the fact that the browser does not load with a browser size as that of browser when tested locally
If you intend to run the test in non headless mode you can use the following code to achieve the result.
IWebElement element= driver.FindElement(By.Id(selector));
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", element);

Related

Cucumber selenium failing in jenkins pipeline only

I am working on an integration test, using Selenium/Java/Cucumber. When I run the test on localhost, or remotely on a VM, it passes fine. But when it runs as part of a Jenkins pipeline it hangs with the error "Timed out receiving message from renderer". I have googled this and there are several possible causes, including version conflicts. But I can't seem to figure out how to check these versions in the jenkins pipeline. Any pointers on what to look into would be helpful. I believe the tests are running headless on the pipeline, because there is no Chromedriver pluigin installed in our Jenkins. The test is pretty straightforward - it involves clicking on an element within an iframe (this is where it hangs) and checking for some output. I have even tested it running manually on the VM created by the very same pipeline and it always works without an issue.

MicrosoftWebDriver 16299, 15063 doesn't work when I minimise Edge browser window

When I execute tests using MicrosoftWebDriver for Edge all works fine, but when I minimise the window all tests become failed. Does Edge or MicrosoftWebDriver have any options to avoid that behavior?
As you have been trying to minimise the Browser Window while your Test Execution is In Progress it will be against all the Best Practices. At this point it is worth to mention that as Selenium mocks the User Actions hence Selenium needs Browser focus. If the focus is lost Selenium won't be able to execute the lines of code. Consider the following steps while your Test Execution :
Browser Maximize : While you execute your tests always keep the Web Browser maximized so majority of the elements are within the Viewport
As per best practices, you should try to execute your Test Scripts / Automation Framework in an isolated Test Environment away from Manual Intervention with all the required Software and Hardware configurations and setup.
You can find a detailed discussion in How to run chrome driver in background using selenium with Ruby for Mac OSx?
You also have an option to use Google Chrome or Mozilla Firefox in Headless version.
For Firefox you can find a detailed discussion in How to make firefox headless programatically in Selenium with python?
For Chrome you can find a detailed discussion in selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH error with Headless Chrome
For Ghost Browser you can find a detailed discussion in Which drivers support “no-browser”/“headless” testing?

Protractor internet explorer tests unstable

I have a angular web application that I want to make protractor tests for the page, And I must run the tests with Internet explorer browser.
However, the tests are not stable, sometimes they all work, sometimes few tests fail randomly.
I am having this issue from 1 month now and I still cannot find solution, here what I tried so far:
Running IEwebdriver explicitly in 32bit or 64bit.
Deleting cache and session after every test.
Increased timeouts in conf.js to 200000.
Adding protractor expected conditions(http://www.protractortest.org/#/api?view=ProtractorExpectedConditions)
Making sure using .then after every function that returns promise.
The reasons of tests failing is slowness of internet explorer, and that it waits for element to be clickable(using protractor expectedconditions) but the element is never clickable, and when I look at the webdriver-manager I see that it trying to do the same lines over and over again.
I am sure that my tests are correct and working fine and I am sure that the browser is the problem.
Can you help? Thanks

Edge browser crashes after "No Such Window exception" with robotframework

I am using Edge web driver with robotframework (selenium2library) on windows 10 VM. When I run the test Edge browser is invoked test are getting executed too but somewhere in the middle (keywords: Wait until element is visible/wait until page contain element) I start getting the error "No Such Window Exception". There are no multiple windows but just a single window. Did someone face these kind of problem? This keyword is already being used for same page and it worked fore few tests but suddenly same page started to fail. It works fine on other browsers
Version Details:
Window 10: 10586.218
Edge Browser:25.10586.0.0
Edge WebDriver: Microsoft WebDriver Fall 2015 Update
The Edge WebDriver is not fully implemented. I appreciate you're essentially saying a keyword that works elsewhere is not working, however you're working with something that's in development:
https://developer.microsoft.com/en-us/microsoft-edge/platform/status/webdriver/details/
We made the call not to use this until it does become fully implemented; that might be something you should consider.

Intern 2.0 test stuck after running client.html page

I have a local selenium server (2.42.2) running with Chromedriver and Firefox. It seems to get stuck after loading and running client.html. I can see that my functional suite code runs in node, far enough to execute the main body. Anything in registerSuite never gets called.
Here are the selenium logs:
http://pastebin.com/KKg5ycvW
I can see the browsers in the selenium sessions page, but they don't appear to be doing anything.
Try opening up a new browser window and paste in the url that you see in the existing selenium ones. Then open up dev tools and see what console errors you are getting.
Intern's runner seems to get stuck in an infinite loop if any uncaught javascript errors are thrown during unit tests if the 'reporter' hasn't been setup yet.
This has been raised as an issue in intern's github repository.