小编Gau*_*ain的帖子

我们如何在机器人框架中一次传递不同的浏览器

*** Variables ***

${BROWSER}          firefox
${URL}              http://url/
${Delay}            0  
Run Code Online (Sandbox Code Playgroud)

在我的settings.txt文件中,我有一个名为{BROWSER}的变量和关联值如上所示它是firefox

但我想要的是

*** Variables ***

@{BROWSERS}         firefox  chrome  IE  
${URL}              http://url/
${Delay}            0  
Run Code Online (Sandbox Code Playgroud)

像上面这样......所以当我首先运行测试套件时它将在firefox中运行并且在完成所有测试用例之后它将关闭firefox并将打开chrome并在chrome浏览器上再次运行所有测试用例..依此类推它将在IE上运行

那我们怎么能这样呢?

我不想手动(我的意思是逐个传递或通过编辑txt文件).完全自动....一旦我运行测试,它将自动在所有浏览器中测试.

PS:这是在settings.txt文件中,我有两个文件夹,其中我有test.txt文件.因此存在主要问题..我必须在循环中迭代这些文件夹

|-- main.py
|-- settings.txt    //in this file i have browser variable (or Array)
|-- test1
|   |-- testl.txt
|   |-- test1_settings.txt  //this will contain all the variables and user defined keyword related to test1 and 
|-- test2
|   |-- test2.txt    
|   |-- test2_settings.txt  //same as test1
Run Code Online (Sandbox Code Playgroud)

我运行这样的测试用例 $pybot test1 test2

python selenium robotframework selenium-webdriver

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

PYTHONPATH在ubuntu 13.04中显示为空

当我这样做时,echo $PYTHONPATH 它不会返回任何东西.空行.

那是什么意思呢.我使用python,它的工作正常..所以什么是pythonpath的使用,这应该是在ubuntu 13.04的价值

/usr/bin/

要么

/usr/lib/

..或者是其他东西

在windows中我们有python27/source目录,我可以把外部源/驱动程序放在ubuntu中(或等效).

当我这样做user@user$ dpkg -L python2.7时显示

/.
/usr
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/lib2to3
/usr/lib/python2.7/lib2to3/fixer_util.py
....
/usr/lib/python2.7/lib2to3/Grammar.txt
/usr/share
/usr/share/doc
/usr/share/doc/python2.7
/usr/share/doc/python2.7/NEWS.gz
/usr/share/doc/python2.7/README.Debian
/usr/share/doc/python2.7/ACKS.gz
/usr/share/doc/python2.7/README.gz
/usr/share/doc/python2.7/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/python2.7
/usr/share/applications
/usr/share/applications/python2.7.desktop
/usr/share/menu
/usr/share/menu/python2.7
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/2to3-2.7.1.gz
/usr/share/man/man1/pdb2.7.1.gz
/usr/share/man/man1/pygettext2.7.1.gz
/usr/share/man/man1/pydoc2.7.1.gz
/usr/share/pixmaps
/usr/share/pixmaps/python2.7.xpm
/usr/bin
/usr/bin/2to3-2.7
/usr/bin/pygettext2.7
/usr/bin/pydoc2.7
/usr/share/doc/python2.7/changelog.gz
/usr/share/doc/python2.7/changelog.Debian.gz
/usr/bin/pdb2.7
Run Code Online (Sandbox Code Playgroud)

我已经从这个站点下载了chrome驱动程序并放入了给定的目录/usr/bin..但它不能正常工作.我应该把它放在哪里? https://code.google.com/p/selenium/wiki/ChromeDriver

ubuntu pythonpath python-2.7 robotframework selenium-webdriver

7
推荐指数
1
解决办法
2万
查看次数

Windows中的Python XVFB错误

对于虚拟帧缓冲(无头测试)我使用的是XvfbPyVirtualDisplay它的工作罚款Ubuntu的,但显示在Windows7错误.这是问题发生的代码的一部分.

from pyvirtualdisplay import Display
display = Display(visible=1, size=(300, 400))
display.start() 
Run Code Online (Sandbox Code Playgroud)

但是当我在Windows中运行相同的命令时,我收到此错误

Traceback (most recent call last):
  File "C:\Python27\Scripts\pynt-script.py", line 9, in <module>
    load_entry_point('pynt==0.8.0', 'console_scripts', 'pynt')()
  File "C:\Python27\lib\site-packages\pynt\_pynt.py", line 295, in main
    build(sys.argv[1:])
  File "C:\Python27\lib\site-packages\pynt\_pynt.py", line 48, in build
    module = imp.load_source(path.splitext(path.basename(args.file))[0], args.fi
le)
  File "build.py", line 7, in <module>
    display = Display(visible=1, size=(300,400))
  File "C:\Python27\lib\site-packages\pyvirtualdisplay\display.py", line 33, in
__init__
    self._obj = self.display_class(
  File "C:\Python27\lib\site-packages\pyvirtualdisplay\display.py", line 50, in
display_class
    cls.check_installed()
  File "C:\Python27\lib\site-packages\pyvirtualdisplay\xvfb.py", line 34, in che …
Run Code Online (Sandbox Code Playgroud)

python python-2.7 xvfb pyvirtualdisplay

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

如何在robobrowser-python中发出POST请求

http://robobrowser.readthedocs.org/en/latest/api.html

我正在尝试使用API browser.open(myurl)并寻找类似于的RB方法requests.post(url,data=data).

因为robobrowser建立在请求和beautifulsoup之上,所以我认为必须有这样做的方法.

python python-2.7 python-requests robobrowser

5
推荐指数
1
解决办法
3554
查看次数