Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 硒罐';无法按名称查找表单元素_Python_Selenium_Webdriver_Selenium Chromedriver_Webdriverwait - Fatal编程技术网

Python 硒罐';无法按名称查找表单元素

Python 硒罐';无法按名称查找表单元素,python,selenium,webdriver,selenium-chromedriver,webdriverwait,Python,Selenium,Webdriver,Selenium Chromedriver,Webdriverwait,我做错了什么?浏览器打开并转到页面,但我收到以下错误消息。我试过xpath;我试过身份证 回溯(最近一次呼叫最后一次): 代码是: link = "https://iccrc-crcic.ca/find-a-professional/" # this will open up new window with the url provided above driver = webdriver.Chrome() driver.get(link) sleep(1)

我做错了什么?浏览器打开并转到页面,但我收到以下错误消息。我试过xpath;我试过身份证

回溯(最近一次呼叫最后一次):

代码是:

link = "https://iccrc-crcic.ca/find-a-professional/"

    # this will open up new window with the url provided above 
driver = webdriver.Chrome()

driver.get(link)

sleep(1)

WebDriverWait(driver,30).until(
     EC.presence_of_element_located((By.NAME, "search_last_name")))


driver.find_element_by_name("search_last_name").send_keys("Smith")

元素位于需要切换的
iframe
中。诱导
WebDriverWait()
并等待
frame\u可用,然后切换到它
(),然后按
css选择器

driver.get("https://iccrc-crcic.ca/find-a-professional/")
wait=WebDriverWait(driver,20)
wait.until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe[src='https://secure.iccrc-crcic.ca/search-new/EN']"))) 
wait.until(EC.element_to_be_clickable((By.XPATH,"//input[@name='search_last_name']"))).send_keys("user1")
要从iframe跳出,您需要使用

driver.switch_to.default_content()
浏览器快照:

真不错。谢谢它起作用了。正如你所知,我是一个新的刮和HTML已经增长了这么多,因为我的日子。再次感谢。嗨,这个网站可以用字母导航,它可以从一开始生成许多页面。每个页面都有一个表,其中有一个带有电子邮件信息的弹出窗口。我已经知道了如何按字母顺序导航和处理表信息,但我无法使用数字来确定页面导航。有什么建议吗?
driver.switch_to.default_content()