Python在网页上选择下拉菜单而不使用Selenium
我需要使用Python打开网页,从下拉列表中选择选项,并在不使用Selenium的情况下进行一些单击。Python中是否有内置的库可以帮助我实现这一点 你试过了吗 这是一个使用它进行浏览器交互的简单示例Python在网页上选择下拉菜单而不使用Selenium,python,webpage,dropdown,Python,Webpage,Dropdown,我需要使用Python打开网页,从下拉列表中选择选项,并在不使用Selenium的情况下进行一些单击。Python中是否有内置的库可以帮助我实现这一点 你试过了吗 这是一个使用它进行浏览器交互的简单示例 from splinter import Browser with Browser() as browser: # Visit URL url = "http://www.google.com" browser.visit(url) browser.fill('
from splinter import Browser
with Browser() as browser:
# Visit URL
url = "http://www.google.com"
browser.visit(url)
browser.fill('q', 'splinter - python acceptance testing for web applications')
# Find and click the 'search' button
button = browser.find_by_name('btnG')
# Interact with elements
button.click()
if browser.is_text_present('splinter.readthedocs.io'):
print("Yes, the official website was found!")
else:
print("No, it wasn't found... We need to improve our SEO techniques")