Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am facing a strange problem with my selenium webdriver qa automation project.

FindElementByXPath(element); seems to work fine when running it in my local machine but then does not work when i try to run the same code on test controller machine. Actually it runs fine when you see the tests running on the test controller machine and if you minimize the test controller window it fails the test.

The application uses telerik rad grids. I have implemented a code to right click on grid header. After right clicking on the grid header i am supposed to click on Reset Columns from the context menu. But in this case FindElementByXPath(resetElement); does not work. It works when you view it but does not work when minimize the mstsc window.

The error shown is Open.QA.Selenium.ElementNotVisibleException: Cannot click on element.

How do I solve this ??

share|improve this question
2  
Maybe this question is related to your problem?: stackoverflow.com/questions/1418082/… –  xeranas Jan 3 '12 at 16:15
1  
xeranas is right - it's the same problem. if you're using remote desktop, make sure the window is not minimized. don't login through remote desktop, use vnc instead. –  Jochen Jan 8 '12 at 21:40
    
Voting to close because there isn't enough data to diagnose the problem. –  user246 Dec 8 '12 at 15:11
    
@user246: What other information would be useful to diagnose the problem? –  dzieciou Dec 10 '12 at 6:53
    
@dzieciou Sorry, never mind. Should have read the question more carefully. –  user246 Dec 10 '12 at 14:38

3 Answers 3

Instead of using "Microsoft Terminal Services Client" for connecting to the virtual machine I would use VNC, since it connects directly to the active session. I have the feeling MS rdp does some more stuff to the session when you connect.

Even better is using a headless browser like PhantomJS. I think it is a more real (headless) browser than HTMLUnit like others are suggestiong to use. PhantomJS is a webkit based headless browser, it should behave similar to Google Chrome and other webkit based browser.

Here is a quick getting started guide: http://itkosmopolit.wordpress.com/2013/11/23/quick-start-of-running-selenium-webdriver-against-phantomjs-in-java-on-windows/

share|improve this answer

This question on StackOverflow seems to be related to your problem; they wanted to minimize the window, which is what seems to be triggering your probelm. From the accepted answer:

There are a few options:

You could use Selenium Grid so that the browser is opened on a completely different machine (or virtual machine) that you can then connect to via VNC or Remote Desktop Connection if you wanted to see the browser.

You can run Selenium 'headless' on Linux. I've never tried doing this and doubt it's really worth the effort. http://www.alittlemadness.com/2008/03/05/running-selenium-headless/

You can wrap Selenium RC in a Windows service. http://support.microsoft.com/kb/137890

Another option would be to use something like WebDriver and use the HTMLUnitDriver, which doesn't launch a 'real' browser. http://code.google.com/p/webdriver/

Of course there's also the option of using a service like SauceLabs, where you can get your tests to be run in the cloud. After your tests have completed you can watch a video of them running.

share|improve this answer

Have you tried the HtmlUnit Driver. I use this driver for the scheduled runs I find its must faster as it doesnt have the overhead of having to render the page and in my experience finds elements just fine.

As I said its great for test automation scheduled runs as long as your not doing manual visual checks or screenshots and have good catches in place for debugging which you should have anyway.

I use HtmlUnit driver for automated runs and switch to firefox etc. for writing, debugging etc.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.