1

I'm using jenkins 2.303.3 and trying to run a selenium project (which passes in local execution). When executing the project via jenkins, I'm failing on 'no such element' (in local run it is recognized). Additional notes:

  • OS: Windows 10
  • browser used: Chrome
  • I've tried adding sleep time which did not help

Can someone please point me to a solution.

Thanks in advance.

R. Zaif
  • 11
  • 1
  • Can you open the website and find ANY element using Selenium? (Screenshot to be sure?). Html of the element you cannot find and sample code? Maybe Jenkins runs headless vs Gui on local? – Taco Verhagen Dec 04 '21 at 12:52
  • using jenkins you are running tests at remote machine or local machine ? add screen shot code on failure to see if url is loaded and no such element can be handled using explicit waits – Amit Jain Dec 04 '21 at 13:36
  • @TacoVerhagen 1. When opening the website, the element can be found, didn't manage to add a screenshot here website: http://the-internet.herokuapp.com/ steps: * click on 'Basic Auth' * enter admin/admin * you will get to 'http://the-internet.herokuapp.com/basic_auth' * you will see the heading 'Basic Auth' (which its css seelctor is: "#content > div > h3" 2. the jenkins error is: TimeoutException: Expected condition failed: waiting for visibility of Proxy element for: DefaultElementLocator 'By.cssSelector: #content > div > h3' (tried for 15 second(s) with 500 milliseconds interval) – R. Zaif Dec 04 '21 at 17:50
  • @TacoVerhagen - how can I know if jenkins is running headless vs. GUI on local? – R. Zaif Dec 04 '21 at 17:52
  • @AmitJain I'm running locally. the error code from jenkins: (I had to delete some lines in order get it in here) page url after successful loginhttp://the-internet.herokuapp.com/basic_auth org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of Proxy element for: DefaultElementLocator 'By.cssSelector: #content > div > h3' (tried for 15 second(s) with 500 milliseconds interval) at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:95) – R. Zaif Dec 04 '21 at 17:53
  • Locally, if you see the browser you run with gui. Sometimes Jenkins uses headless, which might make the browser behalve different. My best guess, take a screenshot (also works headless) to see if that gives a clue: https://www.guru99.com/take-screenshot-selenium-webdriver.html – Taco Verhagen Dec 04 '21 at 22:44

0 Answers0