Home > database >  Unable to access elements of modal [kind of bootstrap] in Selenium javascript
Unable to access elements of modal [kind of bootstrap] in Selenium javascript

Time:12-31

I am not able to enter email and password textboxes available in below modal window....

steps:

  1. Goto enter image description here

    CodePudding user response:

    wait=WebDriverWait(driver,10)                                 
    
    driver.get("https://moneybhai.moneycontrol.com/")
    wait.until(EC.element_to_be_clickable((By.XPATH,"(//a[.='skip'])[1]"))).click()
    wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,"button#loginbtn"))).click()
    wait.until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"#myframe")))
    wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,"div.textfieldbox.PR input#email"))).send_keys("a")
    wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,"div.textfieldbox.PR.usepwd input#pwd"))).send_keys("a" Keys.ENTER)
    

    There was an iframe you needed to switch to.

    <iframe height="495px" width="320px" id="myframe" onl oad="resizeframe();" border="0px" style="margin-top: 50px;" src="https://accounts.moneycontrol.com/mclogin/?d=2"></iframe>
    

    Imports:

    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait 
    from selenium.webdriver.support import expected_conditions as EC
    

    CodePudding user response:

    Able to enter values with below code and its working fine. Thanks.

    await driver.switchTo().frame(driver.findElement(By.id('myframe')))

  • Related