[英]Why do I get the python error saying I don't have the keyboard module when I do?
[英]why do I get a capability error saying that I need to add a capability in my python code?
請檢查此鏈接中的錯誤。 我收到此錯誤。 由於我是新來的,我無法添加圖片。 運行代碼時出現此錯誤。 [1]: https : //i.stack.imgur.com/6XFH3.png
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time
def account_info():
with open('account_info.txt','r') as f:
info = f.read().split()
email = info[0]
password = info[1]
return email, password
email, password = account_info()
tweet = 'Hello world, this is Jarvis'
option = Options()
option.add_argument('start-maximised')
driver = webdriver.Chrome(options=Options)
driver.get('https://twitter.com/login')
您的代碼有一個小錯誤。 您正在將Options
對象傳遞給 webdriver 的options
參數。 相反,傳入您剛剛創建的Options
實例。
# code continues above
tweet = 'Hello world, this is Jarvis'
chrome_options = Options()
chrome_options.add_argument('start-maximised')
driver = webdriver.Chrome(options=chrome_options)
driver.get('https://twitter.com/login')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.