0

I am working on selenium python tests. In my local machine(windows) and remote machine(ubuntu and in headless mode) tests run fine. But on Jenkins pipeline the tests are failing. On remote and jenkins, Selenium version is same 4.1.3. Firefox version is same 98.0.1.

The first test fails with error selenium.common.exceptions.ElementNotInteractableException: Message: Element <a href="/text/funct/num/"> could not be scrolled into view

The window location and size prints same values for in all (windows, remote ubuntu and jenkins) machines

  print(browser.driver.get_window_size())
  print(browser.driver.get_window_position())
Output is same:
{'width': 1366, 'height': 768}
{'x': 0, 'y': 0}

I am trying to understand the issue. How should I debug further.

I am looking for a universal solution for all the errors since I am facing errors in multiple tests.

I have tried setting windows size but it didn't help.

    self.driver.set_window_size(1920, 1080)

I have printed the page source self.driver.page_source and I see the element <a href="/text/funct/num/"> is present in html as <td><a href="/text/funct/num/"><i class="val"></i></a></td>

Dev Env
  • 5
  • 1
  • Do you have any screenshots for when you get the element not interactable exception? That might tell you if your application is rendering correctly on the headless instance. – HSchmale Mar 19 '22 at 15:29
  • No, how to get that – Dev Env Mar 19 '22 at 15:31
  • You have to add a take screenshot call to your try catch in your script. See how to take a screenshot with selenium in python, and an @after function here if you're using python with pytest https://stackoverflow.com/questions/17801300/how-to-run-a-method-before-all-tests-in-all-classes – HSchmale Mar 19 '22 at 15:43
  • The screenshot feature helped. I see in windows and remote machine's screenshot's element which I am trying to click is present but in jenkins screenshot the element to click is not at all present.. – Dev Env Mar 19 '22 at 16:51

0 Answers0