Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium/WebDriver Issue: Seleniums click() method not working sometimes #37

Open
helkv opened this issue Nov 12, 2018 · 1 comment
Open

Comments

@helkv
Copy link

helkv commented Nov 12, 2018

In the Selenium tests the clicking on an element, using Seleniums WebElement.click() method, is sometimes not working.

It seems to be a general Selenium Problem, see: SeleniumHQ/selenium#4075

Characteristics:

  • The WebElement seems to be clicked from Seleniums point of view.
    -- No Error is thrown
    -- On screenshots the button / link is highlighted (it seems to be clicked)
  • The Browser does not recognize the click
    -- The Actions the click should perform does not get performed
  • The failure occurs from time to time
    -- In some cases it occurs on Jenkins but not locally
    -- In some cases it occurs only every hundredth time

Workaround:

  • Using the JavascriptExecutor to click on the element seems to solve the problem in all cases so far:
    ((JavascriptExecutor) driver).executeScript("arguments[0].click();", button);
helkv added a commit that referenced this issue Nov 12, 2018
- Clicking on the minusButton in deleteMetadata() method on the
EditItemPage is not working, when running the tests on jenkins
- Solution I: Use JavascriptExecutor.executeScript (instead of the
normally used WebElement.click()) to click on the element
helkv added a commit that referenced this issue Nov 12, 2018
- Readded all Statement-tests to the testng_edmond_firefox.xml to
execute them on Jenkins
- Using the already added JavascriptExecutor.executeScript Solution I
@vinaybond
Copy link

I tried the solution to click using JS but that does not work either. Looks like this is not a problem of selenium but with the browser. It does not finish JS event/function binding with objects. In such case even if you try to click manually, it won't work (though, clicking at a precise moment is very hard for human).

@helkv helkv changed the title Handle: Seleniums click() method not working sometimes Selenium/WebDriver Issue: Seleniums click() method not working sometimes Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants