我正在使用版本81.0.4044.113(正式版本)(64位)。以前没有发生过,并且代码运行正常。但是几天后,我再次运行了此错误。
我正在使用这些模块->
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
import csv
import time
from tkinter import *
def Authorization():
time.sleep(15)
username = driver.find_element_by_id("userInput")
username.send_keys('username')
driver.find_element_by_xpath("//*[@id='login-button']").click()
time.sleep(5)
password = driver.find_element_by_xpath("//*[@id='passwordInput']")
password.send_keys('password')
submit_button = driver.find_element_by_xpath("//*[@id='login-button']").click()
def Extractor():
time.sleep(25)
integrated_release = driver.find_elements_by_xpath("//*[@id='versionArea']/div/table/tbody/tr[2]/td[2]")
global integrated_release_data
integrated_release_data = [x.text for x in integrated_release]
impact_release = driver.find_elements_by_xpath("//*[@id='versionArea']/div/table/tbody/tr[5]/td[2]")
global impact_release_data
impact_release_data = [x.text for x in impact_release]
build_platform = driver.find_elements_by_xpath("//*[@id='btkArea']/div/table/tbody/tr[2]/td[2]/span")
global build_platform_data
build_platform_data = [x.text for x in build_platform]
def To_csv():
csvData = [final_data]
with open('data.csv', 'a') as csvFile:
writers = csv.writer(csvFile)
writers.writerows(csvData)
csvFile.close()
def printtext():
global bugName
bugName = e.get()
print(bugName)
def kinter():
root = Tk()
root.geometry("500x100")
root.title('xtractor')
var = StringVar()
label = Label( root, textvariable=var)
var.set("Enter")
label.pack()
global e
e = Entry(root)
e.pack()
e.focus_set()
b = Button(root,text='submit',command=printtext)
b.pack(side='bottom')
root.mainloop()
kinter()
driver = webdriver.Chrome()
bugs = bugName.split(',')
driver.get("http........"+bugs[0])
bugname = [bugs[0]]
Authorization()
Extractor()
final_data = a+b+c+d+e
To_csv()
count = 0
for bug in bugs:
try:
if count == 0:
count += 1
continue
driver.get("http:....."+bug)
bugname = [bug]
Extractor()
final_data = a+b+c+d+e
To_csv()
except:
continue
并且我安装了与chrome相同版本的webdriver。知道如何解决这个问题吗?
请在问题中包括完整的异常消息和堆栈跟踪。您还需要包括您在引发异常的地方编写的代码。看到导入很不错,但这看起来不像执行import语句时发生的错误。
—
Greg Burghardt
这是出现并挂起代码的唯一消息。我不想的代码,因为它没有打开。虽然,我已经更改了站点以及变量名。感谢格雷格指出。
—
Aditya Sinha
您使用的是哪个版本的chrome?
—
Greg Burghardt
如上所述,我正在使用版本81.0.4044.113(正式版本)(64位)。
—
Aditya Sinha
您正在使用哪个版本的ChromeDriver?
—
格雷格·伯格哈特