我使用的是Python 2.7和Selenium 2.44.
我想在Selenium WD中自动执行拖放操作,但根据其他相关帖子,Selenium尚不支持HTML5中的操作.有没有办法在Python中模拟拖放?
这是我试过的代码:
driver = webdriver.Firefox()
driver.get("http://html5demos.com/drag")
target = driver.find_element_by_id("one")
source = driver.find_element_by_id("bin")
actionChains = ActionChains(driver)
actionChains.drag_and_drop(target, source).perform()
Run Code Online (Sandbox Code Playgroud)
它不起作用.
对于我的自动化测试,我有一个项目添加到TeamCity服务器和2个代理池,一个是Windows服务器,另一个是MAC.默认代理程序池是WIN,但我想在MAC服务器上运行我的测试.若要更改代理池MAC,我试图通过设置添加代理需求 teamcity.agent.name到MAC server从列表中,但不会添加到与项目相关的相容剂的名单,但加入的相容性助剂与在它上面这样的警告:Following agents belong to the agent pools which are not associated with "Tests" project这里测试是我的项目的名称.
如何将MAC代理与我的项目相关联?
我想在运行测试之前检查api和app是否正在运行.我知道我可以使用CLI获取开放端口列表
sudo lsof -iTCP -sTCP:LISTEN -n -P
但我想写一个python脚本来做到这一点.关于我应该使用什么库或者我该怎么做的任何想法?
我正在尝试使用nose_parameterized测试并希望将其用于单元测试方法。
from nose.tools import assert_equal
from nose_parameterized import parameterized
import unittest
Class TestFoo(unittest.TestCase):
def setUp(self):
self.user1 = "Bar"
self.user2 = "Foo"
@parameterized.expand([
("testuser1",self.user1,"Bar"),
("testuser2",self.user2,"Foo")
]
def test_param(self,name,input,expected):
assert_equal(input,expected)
Run Code Online (Sandbox Code Playgroud)
但self在装饰器函数中没有定义。有解决方法吗?我知道我可以使用全局类变量,但我需要在setUp.
python nose nosetests parameterized-unit-test nose-parameterized