为此苦了几个小时。我的XPath是正确的,但我收到此错误消息。我似乎对此没有前进的方向
此类元素:无法找到元素:{“ method”:“ xpath”,“ selector”:“ // a [@ class ='btn primary block']”} (会议信息:chrome = 68.0.3440.106) (驱动程序信息:chromedriver = 2.41.578706(5f725d1b4f0a4acbf5259df887244095596231db),平台= Mac OS X 10.11.6 x86_64)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:0毫秒 有关此错误的文档,请访问:http://seleniumhq.org/exceptions/no_such_element.html
NydPage nydPage;
GetAQuotePage getAQuotePage;
@FindBy(xpath="//a[@class='btn primary block']")
WebElement GetAQuoteLink;
public NydPage() {
PageFactory.initElements(driver, this);
}
public GetAQuotePage clickOnGetAQuoteLink() throws Exception{
Thread.sleep(5000);
GetAQuoteLink.click();
return new GetAQuotePage();
}
@BeforeMethod
public void setUp() {
//driver = new ChromeDriver();
initialization();
testUtil = new TestUtil();
nydPage = new NydPage();
}
@Test(priority=1)
public void verifyQuotePageLinkTest() throws Exception{
//testUtil.switchToFrame();
Thread.sleep(5000);
getAQuotePage = nydPage.clickOnGetAQuoteLink();
}
@AfterMethod
public void tearDown() {
driver.quit();
}