![](/img/trans.png)
[英]Traceback (most recent call last): error seen on running python file in Pycharm
[英]attribute and traceback call error running behave
在 ubuntu 實例中工作
installed python 3.7.8
installed pip3
installed virtual environment
behave
behave web driver
allure-behave
selenium
chrome driver
運行功能文件時出現錯誤
Exception Attribute Error: 'Options' object has no attribute 'arguments'
Traceback (most recent call last):
File "/home/ubuntu/v/bin/behave", line 8, in <module>
sys exit(main())
File "/home/ubuntu/v/lib/python3.8/site-packages/behave/__main__.py", line 183, in main
return run behave(config) File "/home/ubuntu/v/lib/python3.8/site-packages/behave/__main__.py", line 127, in run behave
failed = runner run()
File "/home/ubuntu/v/lib/python3.8/site-packages/behave/runner.py", line 804, in run
return self run with paths()
File "/home/ubuntu/v/lib/python3.8/site-packages/behave/runner.py", line 808, in run with paths
self. load hooks()
File "/home/ubuntu/v/lib/python3.8/site-packages/behave/runner.py", line 784, in load hooks
exec file(hooks path, self hooks)
File "/home/ubuntu/v/lib/python3.8/site-packages/behave/runner_util.py", line 386, in exec file
exec(code, global , locals_)
File "x/features/environment.py", line 2, in <module>
from core environment import behave driver, launch Browser, close Browser
File "/home/ubuntu/core/environment.py", line 19, in <module>
options arguments("--no-sandbox","--headless");
Attribute Error: 'Options' object has no attribute 'arguments'
這不是將選項傳遞給驅動程序的正確方法。
使用 chrome 驅動程序的示例:
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_arguments("--no-sandbox")
chrome_options.add_arguments("--headless")
browser = webdriver.Chrome(options=chrome_options)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.