Can't Sends Keys to Directed Paypal Login Page

2019-03-04 17:01发布

I'm writing a Auto-Fill bot for Paypal Checkout. The paypal login page is redirected from another website, so it is slightly different to the offical paypal login page, though the HTML is similar.

I've tried different methods like switch to frame, scroll down, execute_script. However, none of them are working and I'm not able to send_keys.

The same things working fine on the official Paypal login page as below:

https://www.paypal.com/signin/?country.x=US&locale.x=en_US

The one that I'm struggling with is:

https://www.paypal.com/checkoutnow?token=EC-1P412919U09359725#/checkout/login

1条回答
看我几分像从前
2楼-- · 2019-03-04 17:29

In your page there is one loader and after that your login options displays in iframe so first you need to put ExplicitWait until your frame get visible and then need to switch into that frame to perform action.

I have following code for the same in Java

WebDriverWait wait = new WebDriverWait(driver, 120);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("injectedUl")));

driver.switchTo().frame(driver.findElement(By.name("injectedUl")));
driver.findElement(By.id("email")).sendKeys("abc@gmail.com");

driver.findElement(By.id("password")).sendKeys("asdsa");

driver.findElement(By.id("btnLogin")).click();

This is equivalent code in Python (Please make correction I'm not much familiar with python )

frame_element = WebDriverWait(driver, 120).until(EC.visibility_of_element_located((By.name, "injectedUl"))
driver.switchTo().frame(driver.find_element_by_name("injectedUl"));
driver.find_element_by_id("email"))send_keys("abc@gmail.com");
driver.find_element_by_id("password")send_keys("asdsa");
driver.find_element_by_id("btnLogin")).click();
查看更多
登录 后发表回答