求助帖 关于selenium+python
自己也上网查了,没找到原因,求助什么原因1.安装python2.75 配置环境变量
2.安装setuptools-0.6c11.win32-py2.7.exe
3.C:\Python27\Scripts, 然后敲入命令: easy_install pip 安装成功
4.pip install –U selenium 安装成功
然后
from selenium import webdriver
browser = webdriver.Firefox()
browser.get("http://www.yahoo.com")
assert "Yahoo!" in browser.title
browser.close()
测试 搭建情况
运行情况 火狐打开但没反应
报错:
Python 2.7.5 (default, May 15 2013, 22:43:36) on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
File "C:\Documents and Settings\Admin\桌面\test_selenium\pytest.py", line 2, in <module>
browser = webdriver.Firefox()
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 61, in __init__
desired_capabilities=capabilities)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 72, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 114, in start_session
'desiredCapabilities': desired_capabilities,
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 163, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 353, in execute
return self._request(url, method=command_info, data=data)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 400, in _request
response = opener.open(request)
File "C:\Python27\lib\urllib2.py", line 404, in open
response = self._open(req, data)
File "C:\Python27\lib\urllib2.py", line 422, in _open
'_open', req)
File "C:\Python27\lib\urllib2.py", line 382, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Python27\lib\urllib2.py", line 1187, in do_open
r = h.getresponse(buffering=True)
File "C:\Python27\lib\httplib.py", line 1045, in getresponse
response.begin()
File "C:\Python27\lib\httplib.py", line 409, in begin
version, status, reason = self._read_status()
File "C:\Python27\lib\httplib.py", line 365, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "C:\Python27\lib\socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
error: 你好,我是新手,公司的程序是C#写的。现在我想用selenium进行自动化测试。测试脚本用C#是不是最好?可是我在网上找不到C#编程语言编写selenium测试的教程,多数都是java或phthyon的教程,十分迷茫呀!
我在想对用C#开发的软件如果用selenium进行自动化测试用java或者Python编程可不可以?如果 可以 的话 是不是 我搭建了java的环境,为了被测程序我还得搭建.net环境吗???可以兼容吗?
页:
[1]