【发布时间】:2020-11-13 17:29:09
【问题描述】:
我正在尝试在此网站上标记超链接“编辑此页面”:https://www.selenium.dev/documentation/en/getting_started/quick/
我的代码是:
driver.get("https://www.selenium.dev/documentation/en/getting_started/quick/");
WebElement elem = driver.findElement(By.linkText("Edit this page"));
Actions actions = new Actions(driver);
Thread.sleep(3000);
actions.moveToElement(elem)
.click()
.keyDown(Keys.CONTROL).sendKeys("a").keyUp(Keys.CONTROL)
.build().perform();
使用此代码,它将标记页面上的所有文本。我怎样才能只标记超链接?
【问题讨论】:
标签: java selenium hyperlink href