angel725 2017-02-28 10:28 采纳率: 73.7%
浏览 1676
已采纳

webdriver 这个变量为什么是未定义

 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

实在找不到原因 了

  • 写回答

2条回答 默认 最新

  • devmiao 2017-02-28 15:12
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 vue2登录调用后端接口如何实现