简体   繁体   English

在jenkins中使用硒时,为什么会出现语法错误?

[英]Why do I get syntax error when using selenium in jenkins?

In a jenkins environment I want to use selenium, but what I get is an error (when trying to import the webdriver): 在詹金斯环境中,我想使用硒,但是得到的是一个错误(尝试导入Webdriver时):

+ python -c 'from selenium import webdriver'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/jenkins/04/workspace/platform.alex-test/venv/lib/python2.6/site-packages/selenium/webdriver/__init__.py", line 18, in <module>
    from .firefox.webdriver import WebDriver as Firefox  # noqa
  File "/jenkins/04/workspace/platform.alex-test/venv/lib/python2.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 34, in <module>
    from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
  File "/jenkins/04/workspace/platform.alex-test/venv/lib/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 991
    return {k: size[k] for k in ('width', 'height')}

Any idea what could go on? 知道会发生什么吗?

  • Version python: 2.6.6 版本python:2.6.6
  • Version selenum: 3.7.0 硒版本:3.7.0

Here is the complete code I execute in jenkins: 这是我在詹金斯执行的完整代码:

virtualenv venv
. venv/bin/activate
pip install selenium
which python
python -c "import selenium; print selenium.__version__"
pip freeze
python -c "from selenium import webdriver"

According to the documentation selenium 3.7.0 is compatible with python 2.6... 根据文档selenium 3.7.0与python 2.6兼容...

In fact, the documentation given here is incorrect. 实际上, 此处给出的文档不正确。 Seleniu 3.7.0 is indeed incompatible with python 2.6: Here is the issue ! Seleniu 3.7.0确实与python 2.6不兼容: 这是问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM