当我试图通过TestNG打开一个站点时,安全页面即将到来,为此我点击了一个链接文本“继续访问本网站(不推荐)”。我通过TestNG编码完成的,但它给java.lang.NullPointerException错误。关于链接文本无法正常工作的Click()函数
,这是我努力的代码......
public class Registration {
WebDriver driver;
WebElement element;
WebElement element2;
WebDriverWait waiter;
@Test(priority = 1)
public void register_With_Cash() throws RowsExceededException, BiffException, WriteException, IOException
{
File file = new File("D:\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
driver=new InternetExplorerDriver();
driver.get("https://172.25.155.250/loginpage.aspx");
sleep(10000);
waiter.until(ExpectedConditions.presenceOfElementLocated(By.linkText("Continue to this website (not recommended).")));
driver.findElement(By.linkText("Continue to this website (not recommended).")).click();
sleep(50000);
感谢名单提前为任何形式的帮助。
哪条线给你例外? –
this one .............. waiter.until(ExpectedConditions.presenceOfElementLocated(By.linkText(“Continue to this website(not recommended)。”))); – imtiyaz
请将您的例外和确切的行粘贴到您的源代码中 – Apostolos