简体   繁体   中英

How to Handle linkedIn authorization Pop up in selenium webdriver using Java?

We are using LinkedIn sign up to use our application. 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM