Can't Sends Keys to Directed Paypal Login Page

若如初见. 提交于 2020-01-30 11:43:08

问题


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:


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


来源:https://stackoverflow.com/questions/42732688/cant-sends-keys-to-directed-paypal-login-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!