Project

General

Profile

automated Web test with Selenium

Added by Mario Diethelm 4 months ago

Hi, I have started to use Selenium with Python to automate regression tests for some of my Wt projects. I general terms, it works fine but I have some issues with some specific objects (mainly WPushButton). In some Web forms, when I try to click over a button the Python code triggers the ElementNotInteractableException exception. The button is correctly located in the form, no problem with that, otherwise Python code would trigger the NoSuchElementException exception but it does never happen.

Does it sound like something that you have identified with some kind of specific problem?

Thanks.


Replies (1)

RE: automated Web test with Selenium - Added by Matthias Van Ceulebroeck 3 months ago

Hello Mario,

this may come from a variety of possible cases:

  • the button isn't in view (or invisible)
    • in this case you can try to increase the size of the window in the driver's options
  • the button isn't fully rendered yet
    • you may need a timeout/wait to ensure the element is fully rendered
  • other?

If all else fails, I believe it's feasible to retrieve the element find_element and execute a click script on it:

item = driver.find_element(By..., ...)
driver.execute_script("arguments[0].click();", item)
    (1-1/1)