jquery - Filling out paypal express checkout selenium -
i'm new sof. have problem filling out paypal login form.
i want script login paypal express checkout page click on pay button return merchant site , click submit button.
for have i've tried several methods can't working. clicks paypal checkout button on merchant site going paypal not fill , script(chrome?) crashes , close chrome.
results=browser.execute_script("window.location='"+carturl+"'") checkbtn=browser.find_element_by_xpath("//div[@class='co-actionscart-bottom- actions checkout-buttons-wrapper clearfix checkout-paypal']//button[@class='co-btn_primary btn_showcart button-full-width button-ctn button-brd-sol button-brd adi-gradient-lightgrey paypal-button track btn btn-paypal btn-block']") print(checkbtn) checkbtn.click() time.sleep(sleeping) time.sleep(sleeping) time.sleep(sleeping) browser.switchto().frame("injectedul") inputelement = browser.find_element_by_name("login_email") inputelement.clear() inputelement.send_keys(cardnum) inputelement = browser.find_element_by_name("login_password") inputelement.clear() inputelement.send_keys(safecode)`
after switched iframe "injectedul"
, have #shadow-root
under sort of hack of javascript devs encapsulate implementation. element inside you'll need like:
htmlelement = driver.find_element_by_tag_name('html') def expand_shadow_element(element): shadow_root = driver.execute_script('return arguments[0].shadowroot', element) return shadow_root shadow_root_under_frame = expand_shadow_element(htmlelement)
then can find inputs looking for:
inputelement = shadow_root_under_frame.find_element_by_name("login_email")
hope helps.
Comments
Post a Comment