<button class="positive auth-button" tabindex="2" type="submit"> Send Me a Push </button>
以上是我的HTML代码。
代码我试图找到元素:
driver.findElement(By.cssSelector("button[type='submit'][class='positive auth-button']")).click();
和
driver.findElement(By.xpath("button[@type='submit'][class='positive auth-button")).click();
答案 0 :(得分:0)
使用以下代码:
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement button = wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(".positive.auth-button[type='submit']")));
button.click();
希望它可以帮到你!
答案 1 :(得分:0)
尝试使用以下代码:
Sub delShapes()
For Each shapeToDelete In ThisWorkbook.Sheets("DB_AL").Shapes
shapeToDelete.Delete
Next shapeToDelete
End Sub
此外,您可以使用以下代码
WebElement ele1 = driver.findElement(By.xpath("//button[@class='positive auth-button'][@type='submit']"));
JavascriptExecutor clickbtn = (JavascriptExecutor)driver;
clickbtn.executeScript("arguments[0].click();", ele1);
答案 2 :(得分:0)
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement button = wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(&#34; .positive.auth-button [type =&#39; submit&#39;]&#34;))); button.click();