ログインしようとすると、モーダルダイアログボックスが表示されるシナリオがあります。
webdriverがモーダルダイアログボックスにアクセスできないため、ログインシナリオを処理できません。これを処理する方法はありますか?
public class TwitterLogin
{
static WebDriver driver;
static String baseUrl="myURL";
public static void main(String[] args)
{
driver= new FirefoxDriver();
driver.get(baseUrl);
driver.manage().window().maximize();
//******Click on Login Link**********//
WebElement LoginButton= driver.findElement(By.xpath("//button[@class='Button StreamsLogin js-login']"));
LoginButton.click();
WebElement UsernameTextbox= driver.findElement(By.xpath("//input[contains(@name,'email]')]"));
UsernameTextbox.clear();
UsernameTextbox.sendKeys("uName");
WebElement PasswdTextbox=driver.findElement(By.xpath("//input[contains(@type,'password')]"));
PasswdTextbox.clear();
PasswdTextbox.sendKeys("1234");
}
}
ログインボタンをクリックした後、ユーザー名とパスワードを入力できません。
ログインボタンをクリックした後、次のコードを書くだけです。
Thread.sleep(3000); //i use here wait implicit wait. Try to use explicit wait here.
driver.findElement(By.cssSelector("a.Icon.Icon--close.Icon--medium.dismiss")).click();
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加