enter image description here如何单击立即应用按钮
立即申请
我尝试过但没有用
use autodie qw(:all);
use Path::Tiny qw(path);
for my $archive (qw(first.tgz sec.tgz third.tgz n.tgz)) {
my $basename = path($archive)->basename('.tgz');
path($basename)->mkpath;
system qw(aunpack -X), $basename, $archive;
}
答案 0 :(得分:2)
我认为您的xpath查询不正确。我会这样写
WebElement applyButton = driver.findElementByXPath("//a[text() = 'Apply Now']");
applyButton.click()
答案 1 :(得分:0)
使用XPath contains() function进行部分匹配的正确语法为:
WebElement Apply =driver.findElementByXPath("//a[contains(text(),'Apply now')]");
您可能会发现ByPartialLinkText定位器更易于使用
WebElement Apply = driver.findElement(By.partialLinkText("Apply Now"));
您可能还希望将其包装到WebDriverWait中:
WebElement Apply = new WebDriverWait(driver, 10)
.until(ExpectedConditions
.presenceOfElementLocated(By
.partialLinkText("Apply Now")));
最后根据Java naming conventions,您可能希望将此Apply
设为小写的a