硒点击不适用于Chrome 72

时间:2019-03-14 09:57:22

标签: selenium selenium-chromedriver

我使用selenium来自动化网站,它具有处理单击操作的代码,但是执行脚本时页面没有响应。

  • Selenium-java: 3.141.9

  • Chrome版本:72.0.3626.119(官方) 内部版本)(32位)

  • Chromedriver: 2.46

我想念这里吗?

注意:所有点击操作均无效

代码如下:

public static void webtouch() {
    Map<String, String> mobileEmulation = new HashMap<String, String>();
    mobileEmulation.put("deviceName", "Galaxy S5");
    System.setProperty("webdriver.chrome.driver", "drivers//chromedriver_73.exe");
    String webTouchUrl = "https://www.xxxxxxx";

    ChromeOptions cOptions = new ChromeOptions();
    cOptions.setExperimentalOption("mobileEmulation", mobileEmulation);
    WebDriver driver = null;
    try {
        System.out.println("-----Go into initiate appium driver");
        driver = new ChromeDriver(cOptions);
        driver.get(webTouchUrl);
        System.out.println("-----Complete to initiate appium driver");
        Thread.sleep(3000);
        driver.findElement(By.xpath(" //*[@id='userid']")).click(); // no response after click
        driver.findElement(By.xpath(" //*[@id='userid']")).sendKeys("test");

        driver.findElement(By.xpath("//a[contains(text(),'Continue')]")).click(); // no response after click

        Thread.sleep(3000);
        System.out.println("+++++++++++++++++++++++");
        driver.quit();
        webOperate(driver);
    } catch (Exception e) {
        System.out.println("Exception occurs: " + e.getMessage());
        e.printStackTrace();
        driver.quit();
    }


}

0 个答案:

没有答案