[英]How to Handle linkedIn authorization Pop up in selenium webdriver using Java?
We are using LinkedIn sign up to use our application. 我们正在使用LinkedIn进行注册以使用我们的应用程序。 But when I try automation, I face an issue finding the username and password elements.
但是,当我尝试自动化时,在查找用户名和密码元素时会遇到问题。 How can I fetch those elements?
我该如何获取这些元素?
Here is the code so far; 这是到目前为止的代码;
public void testUntitled() throws Exception {
driver.get(baseUrl + "/login");
driver.findElement(By.id("li_ui_li_gen_1393418749917_0-logo")).click();
// ERROR: Caught exception [ERROR: Unsupported command [waitForPopUp | easyXDM_IN_Lib_li_gen_1393418780585_1_provider_popup | 30000]]
// ERROR: Caught exception [ERROR: Unsupported command [selectWindow | name=easyXDM_IN_Lib_li_gen_1393418780585_1_provider_popup | ]]
driver.findElement(By.id("session_key-oauthAuthorizeForm")).clear();
driver.findElement(By.id("session_key-oauthAuthorizeForm")).sendKeys("abc@rediffmail.com");
driver.findElement(By.id("session_password-oauthAuthorizeForm")).clear();
driver.findElement(By.id("session_password-oauthAuthorizeForm")).sendKeys("123456");
driver.findElement(By.name("authorize")).click();
}
You need to transfer control to the popup window after you click on the LinkedIn Logo. 单击LinkedIn徽标后,需要将控制权转移到弹出窗口。 Then try to search for the username and password fields.
然后尝试搜索用户名和密码字段。
Dont forget to switch back to the main window handle after the authorization steps are done with. 完成授权步骤后,请不要忘记切换回主窗口句柄。
Here is a way to do it - How to handle Pop-up in Selenium WebDriver using Java 这是一种实现方法- 如何使用Java处理Selenium WebDriver中的弹出窗口
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.