如何自动响应clickable = false的本机应用程序

时间:2017-10-05 06:27:33

标签: selenium-webdriver react-native appium

我试图通过Appium自动化React本机android应用程序,我试图点击按钮但它是clicakble=false所以我无法再做进一步的脚本

1 个答案:

答案 0 :(得分:0)

尝试使用JavascriptExecutor

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

OR

            Point point = ad.findElement(filter).getLocation();
            int elementCenterX = point.getX() + 80;
            int elementCenterY = point.getY() + 100;
            System.out.println("value of x = "+elementCenterX+"   value of y = "+elementCenterY);
            ad.tap(2, elementCenterX , elementCenterY , 0);
            System.out.println("click on result");