我正在尝试自动化网站
下面是我的 HTML 代码
<span _ngcontent-tkv-c48="" class="ng-star-inserted" xpath="1">Search flights</span>
以下是我尝试了三种方式的代码
driver.findElement(By.xpath("//span[@class='ng-star-inserted']")).click();
WebElement element = driver.findElement(By.xpath("//span[@class='ng-star-inserted']"));
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].click();", element);
Actions a=new Actions(driver);
a.moveToElement(driver.findElement(By.xpath("//span[@class='ng-star-inserted']")))
.doubleClick()
.perform();