Select window unable to select Childwindow

后端 未结 1 1350
梦谈多话
梦谈多话 2021-01-24 16:58

In My JavaCode , After clicking on Edit Description link a window get opens (i.e. Java Script Window) Images here 1st one gives anchor tag with attributes and 2nd one is opened

相关标签:
1条回答
  • 2021-01-24 17:16

    It is pretty clear from your snapshot that the window which gets opened is a JavaScript window i.e. an Alert. To enter some text into the Text Area and click Ok you can use the following block of code :

    import org.openqa.selenium.Alert;
    import org.openqa.selenium.By;
    import org.openqa.selenium.support.ui.WebDriverWait;
    import org.openqa.selenium.support.ui.ExpectedConditions;
    //other code
    Alert myAlert = new WebDriverWait(driver, 10).until(ExpectedConditions.alertIsPresent());
    myAlert.sendKeys("I_am_bbk");
    myAlert.accept();
    driver.quit();
    
    0 讨论(0)
提交回复
热议问题