Selenium webdriver click vs action.click whats the difference?

前端 未结 2 1908
攒了一身酷
攒了一身酷 2021-01-05 01:17

I was struggling with a popup dialog in a website I\'m automating, for some reason it wouldn\'t click a button in the dialog but interacted fine with everything else fine.

2条回答
  •  [愿得一人]
    2021-01-05 02:10

    Just testing similar scenario.

    First with Actions click:

    actions.moveToElement(driver.findElement(By.xpath("//*[@id='relevantJobsAndCareerUpdates_1']"))).click().perform()
    

    And second one with WebElement click:

    driver.findElement(By.xpath("//*[@id='relevantJobsAndCareerUpdates_1']"))).click()
    

    The second one does not work. It gives the error message:

    Root cause: org.openqa.selenium.WebDriverException: unknown error: Element  is not clickable at point (307, 24). Other element would receive the click: 
    

    This is the similar problem as previous. Using Actions solve this problem.

提交回复
热议问题