• <bdo id='HOBqi'></bdo><ul id='HOBqi'></ul>
      1. <small id='HOBqi'></small><noframes id='HOBqi'>

        <tfoot id='HOBqi'></tfoot>
        <i id='HOBqi'><tr id='HOBqi'><dt id='HOBqi'><q id='HOBqi'><span id='HOBqi'><b id='HOBqi'><form id='HOBqi'><ins id='HOBqi'></ins><ul id='HOBqi'></ul><sub id='HOBqi'></sub></form><legend id='HOBqi'></legend><bdo id='HOBqi'><pre id='HOBqi'><center id='HOBqi'></center></pre></bdo></b><th id='HOBqi'></th></span></q></dt></tr></i><div id='HOBqi'><tfoot id='HOBqi'></tfoot><dl id='HOBqi'><fieldset id='HOBqi'></fieldset></dl></div>
        <legend id='HOBqi'><style id='HOBqi'><dir id='HOBqi'><q id='HOBqi'></q></dir></style></legend>

        Python - selenium webdriver - 无法切换到注册弹出窗口

        时间:2023-10-01

        <small id='z31qI'></small><noframes id='z31qI'>

        <legend id='z31qI'><style id='z31qI'><dir id='z31qI'><q id='z31qI'></q></dir></style></legend>

        • <tfoot id='z31qI'></tfoot>

            • <bdo id='z31qI'></bdo><ul id='z31qI'></ul>
                <i id='z31qI'><tr id='z31qI'><dt id='z31qI'><q id='z31qI'><span id='z31qI'><b id='z31qI'><form id='z31qI'><ins id='z31qI'></ins><ul id='z31qI'></ul><sub id='z31qI'></sub></form><legend id='z31qI'></legend><bdo id='z31qI'><pre id='z31qI'><center id='z31qI'></center></pre></bdo></b><th id='z31qI'></th></span></q></dt></tr></i><div id='z31qI'><tfoot id='z31qI'></tfoot><dl id='z31qI'><fieldset id='z31qI'></fieldset></dl></div>
                    <tbody id='z31qI'></tbody>
                  本文介绍了Python - selenium webdriver - 无法切换到注册弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I am new to python (2.7) & selenium webdriver. And I am trying to do registration for http://way2automation.com/way2auto_jquery/index.php

                  So far i got stuck at switching to the registration pop-up.

                  I've tried

                  driver.get("http://www.way2automation.com/demo.html")
                  regElem = driver.find_element_by_link_text("Registration").click()
                  
                  driver.switch_to.frame(driver.find_element_by_id("login"))
                  
                  nameElem = driver.find_element_by_name("name").clear()
                  nameElem.send_keys("NameBla")
                  

                  In the place where i try to switch to the pop-up i've checked different xpathes & different methods switch_to_frame / switch_to_window / alert / etc. But no luck :(

                  解决方案

                  There is actually no iframes that you need to handle. Target fieldset located in a simple div, so you need just to wait for its presence

                  from selenium import webdriver
                  from selenium.webdriver.common.by import By
                  from selenium.webdriver.support.ui import WebDriverWait
                  from selenium.webdriver.support import expected_conditions as EC
                  
                  
                  driver = webdriver.Chrome()
                  driver.get("http://www.way2automation.com/demo.html")
                  current = driver.current_window_handle
                  driver.find_element_by_link_text("Registration").click()
                  new =  [window for window in driver.window_handles if window != current][0]
                  driver.switch_to_window(new)
                  wait = WebDriverWait(driver, 10)
                  nameElem = wait.until(EC.element_to_be_clickable((By.NAME,'name')))
                  nameElem.send_keys("NameBla")
                  

                  without switching to frame / switch_to_window / alert / etc

                  这篇关于Python - selenium webdriver - 无法切换到注册弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:关闭“确认导航"Watir 的弹出窗口 下一篇:chrome 扩展弹出窗口无法按 ID 找到元素

                  相关文章

                  • <bdo id='puP3v'></bdo><ul id='puP3v'></ul>

                1. <tfoot id='puP3v'></tfoot>

                  <small id='puP3v'></small><noframes id='puP3v'>

                  <i id='puP3v'><tr id='puP3v'><dt id='puP3v'><q id='puP3v'><span id='puP3v'><b id='puP3v'><form id='puP3v'><ins id='puP3v'></ins><ul id='puP3v'></ul><sub id='puP3v'></sub></form><legend id='puP3v'></legend><bdo id='puP3v'><pre id='puP3v'><center id='puP3v'></center></pre></bdo></b><th id='puP3v'></th></span></q></dt></tr></i><div id='puP3v'><tfoot id='puP3v'></tfoot><dl id='puP3v'><fieldset id='puP3v'></fieldset></dl></div>
                    <legend id='puP3v'><style id='puP3v'><dir id='puP3v'><q id='puP3v'></q></dir></style></legend>