How to avoid MouseOver on Selenium Click()

前端 未结 2 1402
囚心锁ツ
囚心锁ツ 2020-12-22 14:01

In one of my Selenium test cases, I have the problem that there are MouseOver effects that I don\'t want to have. This is what I do:

  1. Click on the \"login\" but
2条回答
  •  北荒
    北荒 (楼主)
    2020-12-22 14:14

    As Andrew is right. If it is not happening manually then it should not happened here as well.

    You can also try to click using JavascriptExecutor

    WebElement element= driver.findElement(By.xpath("Your Xpath"));
    
    JavascriptExecutor executor = (JavascriptExecutor) driver;
    executor.executeScript("arguments[0].click();", element);
    

    Below is some example that how you can do it using C#

    Execute JavaScript using Selenium WebDriver in C#

    Hope it will help you :)

提交回复
热议问题