小编Gho*_*ost的帖子

使用无头Chrome浏览器时ElementNotVisibleException

当我在无头模式chrome浏览器中运行测试脚本时,元素链接不可见,无法做到linkElement.click().在头模式下一切都好.所有其他信息都在stacktrace中.谁知道该怎么办,拜托?

堆栈跟踪:

发生错误:消息:元素不可见
(会话信息:headless chrome = 60.0.3112.90)
(驱动程序信息:chromedriver = 2.31.488763(092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform = Windows NT 6.1.7601 SP1 x86_64)
Traceback(最近一次调用最后一次):
文件"C:\nik-x.py",第148行,在主
func(nik)
文件"C:\ lib\support.py"中,第121行,在包装器中
提升
文件"C:\ lib\support.py" ",第108行,在newFunc
res [0] = func(*args,**kwargs)
文件"C:\ testcases \nik-1003.py",第37行,在testcase中
i.click()
文件"C:\ Python36\lib\site-packages\selenium\webdriver\remote\webelement.py",第7行7
,单击
self._execute(Command.CLICK_ELEMENT)
文件"C:\ Python36\lib\site-packages\selenium\webdriver\remote\webelement.py",第4行
93,在_execute中
返回self._parent.execute(command,params)
文件"C:\ Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py",第25行
6,执行
self.error_handler.check_response(响应)
文件"C:\ Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py",li ne
194,in check_response
raise exception_class(message,screen,stacktrace)
selenium.common.exceptions.ElementNotVisibleException:Message:element not visible
(Session info:headless chrome = 60.0.3112.90)
(Driver info:chromedriver = 2.31.488763(092de99f48a300323ecf8c2a4e2e7cab51de5ba8) ,platform = Windows NT 6.1.7601 SP1 x86_64)

这是我的一段代码:
icons = nik.elementLeftmenuSportIcons() for i in …

selenium selenium-chromedriver python-3.6 google-chrome-headless

10
推荐指数
1
解决办法
7431
查看次数

使用带有 Python 的 Selenium Webdriver 在 Headless chrome 浏览器上运行脚本时发生超时错误

当我在Headless Chrome Broswer (Webdriver + Selenium )上运行 python 脚本测试网站时,经常会出现超时错误,我发现问题是脚本通过.click().send_keys()方法与浏览器交互时发生的。谁能知道这是什么类型的问题?有时它工作正常,但有时我有超时错误。请给出相同的解决方案

堆栈跟踪:

 15:01:48,194 root:ERROR: ERROR occurred: Message: timeout
   (Session info: headless chrome=60.0.3112.101)
   (Driver info: chromedriver=2.31.488763 
   (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 
    x86)

    Traceback (most recent call last):
  File "c:\autotest\x.py", line 148, in main
    func(nik)
  File "c:\autotest\lib\support.py", line 126, in wrapper
    raise ret
  File "c:\autotest\lib\support.py", line 113, in newFunc
    res[0] = func(*args, **kwargs)
  File "c:\autotest\testcases\1001.py", line 15, in testcase
    "documents_approved ASC", generateError=True)  
  File "c:\autotest\lib\support.py", line 51, in wrapper
    f_result = …
Run Code Online (Sandbox Code Playgroud)

python selenium google-chrome headless-browser selenium-webdriver

6
推荐指数
1
解决办法
3432
查看次数