我如何点击按钮法师我 试图与XPath和ID下面是我曾试图 driver.findElementById(“btn_google”)提到的代码。单击( ); // driver.findElementByName(“Login with Google +”)。click(); //driver.findElementByXPath("//android.widget.ImageButton[@content-desc='Login with Google +',@ resource-id,'btn_google']“)。click(); // driver.findElementByXPath(“// android.widget.Button [contains(@ resource-id,'btn_google')and @ content-desc,'用Google +登录']”)。click();
// driver.findElementByXPath("//*[@class='android.widget.ImageButton' and @resource-id='btn_google']").click();
//driver.findElementByName("Login with Google+").click();;
WebElement element=driver.findElementByXPath("//*[@class='android.widget.ImageButton' and @resource-id='btn_google']");
TouchAction action = new TouchAction(driver);
action.longPress(element).release().perform();
//driver.findElement(By.xpath("//android.widget.ImageButton[@content-desct='Login with Google+']")).click();
// WebElement googlebutton = driver.findElementByXPath( “// android.widget.ImageButton [@资源-ID = 'com.zipgo.customer:ID/btn_google']”); // googlebutton.click();
您的上一个xpath似乎是正确的。在执行该命令来查找ImageButton之前,请确保您的应用程序的屏幕已完全加载。 – Vinod