0
我需要使用Python打開網頁,從下拉列表中選擇選項,並在不使用Selenium的情況下進行點擊操作。 Python中有沒有內置的庫可以幫助我做到這一點?Python在不使用Selenium的情況下選擇網頁上的下拉菜單
我需要使用Python打開網頁,從下拉列表中選擇選項,並在不使用Selenium的情況下進行點擊操作。 Python中有沒有內置的庫可以幫助我做到這一點?Python在不使用Selenium的情況下選擇網頁上的下拉菜單
你試過Splinter
這是使用它瀏覽器交互的一個簡單的例子。
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")