我试图切换到一个新的框架,点击按钮后打开。不幸的是,我收到一个无值
driver = webdriver.Firefox()
driver.get('https://www.milanuncios.com/dacia-de-segunda-mano/dacia-sandero-1-5-dci-exportacion-323650137.htm')
time.sleep(5)
driver.find_element_by_xpath('//button[@id="pagAnuShowContactForm"]').click()
time.sleep(5)
在这里,它可以打开联系信息。在这里,我想在新打开的窗口中执行操作。 我尝试了以下选项:
1
contact = driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
2
contact = driver.find_element_by_xpath('//div[@class="telefonos"]')
元素存在于iframe ID
ifrw
中,您需要首先切换到iframe诱导
WebDriverWait
和frame_to_be_available_and_switch_to_it
()诱导
WebDriverWait
和visibility_of_element_located
()输出:
相关问题 更多 >
编程相关推荐