Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Java处理SeleniumWebDriver中的linkedIn授权弹出窗口?_Java_Selenium - Fatal编程技术网

如何使用Java处理SeleniumWebDriver中的linkedIn授权弹出窗口?

如何使用Java处理SeleniumWebDriver中的linkedIn授权弹出窗口?,java,selenium,Java,Selenium,我们正在使用LinkedIn注册来使用我们的应用程序。但是当我尝试自动化时,我会遇到一个问题:如何找到用户名和密码元素。如何获取这些元素 以下是迄今为止的代码 public void testUntitled() throws Exception { driver.get(baseUrl + "/login"); driver.findElement(By.id("li_ui_li_gen_1393418749917_0-logo")).click(); // ERROR

我们正在使用LinkedIn注册来使用我们的应用程序。但是当我尝试自动化时,我会遇到一个问题:如何找到用户名和密码元素。如何获取这些元素

以下是迄今为止的代码

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();
}

单击LinkedIn徽标后,您需要将控制权转移到弹出窗口。然后尝试搜索用户名和密码字段

完成授权步骤后,不要忘记切换回主窗口句柄


下面是一种方法-

您使用哪种web浏览器?