LinameF = driver.find_element_by_css_selector('div.GiftEffect > ul li.GiftEffectItem.t div div.userBox div.content p.name').text
(它在线程中,)
然后程序就出这种错误:
Exception in thread Thread-6:
Traceback (most recent call last):
File "E:\Python\Python35-32\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "E:\Python\Python35-32\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "H:/PycharmProjects/src/ome.py", line 155, in st
tagNamef()
File "H:/PycharmProjects/src/ome.py", line 94, in tagNamef
LinameF = driver.find_element_by_css_selector('div.GiftEffect > ul li.GiftEffectItem.t div div.userBox div.content p.name').text
File "E:\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 437, in find_element_by_css_selector
return self.find_element(by=By.CSS_SELECTOR, value=css_selector)
File "E:\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 752, in find_element
'value': value})['value']
File "E:\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "E:\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 408, in execute
return self._request(command_info[0], url, body=data)
File "E:\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 439, in _request
self._conn.request(method, parsed_url.path, body, headers)
File "E:\Python\Python35-32\lib\http\client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "E:\Python\Python35-32\lib\http\client.py", line 1141, in _send_request
self.putrequest(method, url, **skips)
File "E:\Python\Python35-32\lib\http\client.py", line 974, in putrequest
raise CannotSendRequest(self.__state)
http.client.CannotSendRequest: Request-sent
实在找不到原因 了
https://zhidao.baidu.com/question/556981363314840092.html
1,你的变量是不是跨域了? 全局的还是local的?
2,使用线程的时候,你要在线程外部定义变量,这样子内部才能访问,别的线程也能访问.