1

I'm running a suite of tests in Robot Framework, and while the code runs fine visually, it breaks when run on the XVFB via Jenkins.

The point where the code breaks is Click Element xpath=//*[@id="FullContentPane"]//a[2]. When run visually, this element locator is able to find the correct element, but when run on the XVFB, it can't find the element and it responds with an Element Not Found error message.

I have also tried dom=document.getElementsByClassName("fa fa-window-close")[0] and dom=document.getElementsByTagName("i")[2], which get the same result.

Here's the HTML for the element (part of an angular application):

<a href="javascript:;">
    <i class="fa fa-window-close">
        ::before
        " Save "
    </i>
</a>

I'd also try Click Link href="javascript:;", but that's at least the second <a> element with the same href on the page.

I'm not necessarily interested in how I can click on this element (not that I'd complain if you have another approach that works). I'm more interested in why I can't click on it, so that I can avoid this issue in the future. What is it about XVFB that causes some element locators (and not others) to fail like this?

Brandon Olson
  • 619
  • 2
  • 6
  • 19
  • Is the XVFB the only thing that is different? I.e. Browser Vendor, Version, OS, Python version, module (Selenium, Selenium?Library), Resolution and Webdriver. In case Chrome is your preferred browser, have you tried running it in it's native headless mode? – A. Kootstra Dec 01 '17 at 18:18
  • As far as I can determine, the XVFB is the only difference. I was not aware of Chrome having a native headless mode, but I'll look into that. – Brandon Olson Dec 01 '17 at 18:40
  • 1
    Have a look at the [answer](https://stackoverflow.com/questions/47529897/how-to-download-a-file-with-phantomjs-using-robot-framework/47559838#47559838) on this [so] question. – A. Kootstra Dec 01 '17 at 18:44
  • Certainly looks interesting, I'll try it out. Might have just changed our entire tool chain for running headless tests. – Brandon Olson Dec 01 '17 at 18:50
  • have you tried taking a screenshot and dumping the html data for the page? Is the size of the browser window the same in xvfb as when running on the desktop? – Bryan Oakley Dec 01 '17 at 20:08
  • I'm not the developer of the page and I'm pretty sure that dumping the HTML of the page in its entirety would run into some proprietary information issues, so if what you're asking for is the full HTML of the entire page, I'm not sure I can give that. Yes, I have double-checked that the size of the browser in xvfb is the same as running on the desktop. – Brandon Olson Dec 01 '17 at 20:10
  • The HTML page is not for publishing on [so] but rather for you to compare against the HTML retrieved from a working test. It's the delta that's interesting not the entire document. – A. Kootstra Dec 02 '17 at 07:48

0 Answers0