我必须访问一个链接,在那里我必须输入我的电子邮件ID。它将重定向到带有基本授权弹出窗口的某些动态链接。我正在使用自动IT输入以前输入的电子邮件ID及其密码。这将打开所需的网站。我一次又一次地运行相同的代码,即使我没有进行任何更改,它仍可在95%的时间内正常工作。
import java.io.IOException;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class logIn {
public static void main(String[] args) throws IOException, InterruptedException {
System.setProperty("webdriver.chrome.driver",
"C:\\Selenium\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://somewebsite.com");
driver.findElement(By.xpath("//*[@id=\"i0116\"]")).sendKeys("gaurav@work.com");
driver.findElement(By.xpath("//*[@id=\"idSIButton9\"]")).click();//it takes some time from here
Runtime.getRuntime().exec("C:\\Desktop\\sss.exe");//it takes some time from here too
System.out.println("Auto It is executed");
Thread.sleep(30000);
Thread.sleep(30000);
driver.findElement(By.xpath("//*[@id=\"AppFilterButton\"]")).click();
driver.findElement(By.xpath("//*[@id=\"Filter-spendMgmt\"]")).click();
}
}
我的autoIT代码
WinWaitActive("https://bbb.com")
Send("gaurav@work.com")
Send("{Tab}")
Send("password")
Send("{Enter}")
在我重定向到另一个页面时,我经常会收到此错误
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <input type="submit" id="idSIButton9" class="btn btn-block btn-primary" data-bind="