我已经在linux
上设置了机器人框架以及python和selenium。
当我执行sample.robot文件(以启动浏览器)时,它工作正常。但是在调用硒api
时遇到问题。
在test.robot中的validate_google_page
被调用时,它将引发错误。
我在这里错过任何路径吗?
sample.robot:运行正常
test.robot:遇到错误AttributeError:'NoneType'对象没有属性'implicitly_wait'
哪个python
/usr/bin/python
export $PYTHONPATH
-bash: export: `/usr/bin/python': not a valid identifier
echo $PATH
/home/user_name/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
pip show robotframework
Name: robotframework
Version: 3.0.2
Summary: Generic automation framework for acceptance testing and robotic process automation (RPA)
Home-page: http://robotframework.org
Author: Pekka Klärck
Author-email: peke@eliga.fi
License: Apache License 2.0
Location: /home/user_name/.local/lib/python2.7/site-packages
Requires:
uname -a
Linux ip-10-10-10-10 4.15.0-1032-aws #34-Ubuntu SMP Thu Jan 17 15:18:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Installed
robotframework==3.0.2
robotframework-debuglibrary==1.1.4
robotframework-pageobjects==1.3.3
robotframework-selenium2library==1.8.0
sample.robot
*** Settings ***
Library Selenium2Library
Suite Teardown Close All Browsers
Test Setup Open Chrome
*** Keywords ***
Open Chrome
${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${chrome_options} add_argument --disable-extensions
Call Method ${chrome_options} add_argument --headless
Call Method ${chrome_options} add_argument --disable-gpu
Call Method ${chrome_options} add_argument --no-sandbox
Create Webdriver Chrome chrome_options=${chrome_options}
*** Test Cases ***
Go to google
Go To https://google.com
test.robot
*** Settings ***
Library Selenium2Library
Library ../some_path/directory/test.py
Suite Teardown Close All Browsers
Test Setup Open Chrome
*** Keywords ***
Open Chrome
${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${chrome_options} add_argument --disable-extensions
Call Method ${chrome_options} add_argument --headless
Call Method ${chrome_options} add_argument --disable-gpu
Call Method ${chrome_options} add_argument --no-sandbox
Create Webdriver Chrome chrome_options=${chrome_options}
*** Test Cases ***
Go to google
Go To https://google.com
validate_google_page
test.py
from robotpageobjects import Page, robot_alias
import time
from time import sleep
class Test(Page):
selectors = {
"search username": "id=userName",
"search password": "id=password"
}
def validate_google_page(self):
self.wait_until_element_is_visible("search username")
return self
错误:AttributeError:'NoneType'对象没有属性'implicitly_wait' 预期:应平稳运行。