嗨我正在使用Selenium Standalone Server和Selenese命令执行程序在Mac OS X上测试Safari.我在单击特定页面上的某些按钮时遇到问题.同样的点击在其他浏览器中也能完美运行,如firefox(Windows),chrome(Windows + Mac),IOS模拟器,IE.我也能通过id获取按钮.通过使用getText()获取按钮文本来确认.在click命令之后,没有任何事情发生.我尝试过使用button.click(),button.submit().还使用id,xpath,类来查找按钮.正如我所提到的:我能够获得id,只是点击不起作用.有什么建议?一些代码是:
public static WebDriver getSafariDriver()
{
try
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("safari");
capabilities.setJavascriptEnabled(true);
CommandExecutor executor = new SeleneseCommandExecutor(new URL("http://localhost:4444/"), new URL("http://www.google.com/"), capabilities);
WebDriver driver = new RemoteWebDriver(executor, capabilities);
return driver;
} catch (MalformedURLException e)
{
e.printStackTrace();
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
是否有通过命令提示符的解决方法?或者其他任何我可以尝试或错过的东西?请帮忙.
当您在鼻子中运行测试时,我想在命令行上显示测试本身的文件名和行号,特别是当它失败时,我可以跳转到emacs中的行.我已经在case.py中插入了一些代码来打印出名称,我看到我可以创建一个处理prepareTestCase的插件,但我的问题是是否有插件可以做到这一点?
这是我的代码:nose/case.py:
import inspect
...
def runTest(self, result):
...
if not isinstance(test,Failure):
print(" File \"%s\", line %s\n" % (
inspect.getsourcefile(test.test),
inspect.getsourcelines(test.test)[1]))
Run Code Online (Sandbox Code Playgroud) 我想知道如何在列表中对值进行排序,然后将类似的值分解为子列表.
例如:我想要一个可能做类似的功能
def sort_by_like_values(list):
#python magic
>>>list=[2,2,3,4,4,10]
>>>[[2,2],[3],[4,4],[10]]
OR
>>>[2,2],[3],[4,4],[10]
Run Code Online (Sandbox Code Playgroud)
我阅读了已排序的api,它可以很好地在自己的列表中对事物进行排序,但不会将列表分解为子列表.什么模块可以帮到我这里?
所以,我正试着习惯去!我遇到了一个问题,我尝试创建一个包含切片的新数据类型"RandomType".
package main
type RandomType struct {
RandomSlice []int
}
func main() {
r := new(RandomType)
r.RandomSlice = make([]int, 0)
append(r.RandomSlice, 5)
}
Run Code Online (Sandbox Code Playgroud)
这段代码会产生错误:
append(r.RandomSlice, 5) not used
Run Code Online (Sandbox Code Playgroud)
但是,例如,如果我尝试
type RandomType struct {
RandomInt int
}
func main() {
r := new(RandomType)
r.RandomInt = 5
}
Run Code Online (Sandbox Code Playgroud)
这很好用.
不知道我做错了什么.