我怎样才能获得23的,而不是1对$lastnum1?
$text = "1 out of 23";
$lastnum1 = $this->getEval(eregi_replace("[^* out of]", '', $text));
Run Code Online (Sandbox Code Playgroud) 在代码中:
<img style="cursor: pointer; background-color: transparent;" onclick="changeTeamHint(2155);" src="/images/icon_edit_inactive.png">
Run Code Online (Sandbox Code Playgroud)
onclick="changeTeamHint(2155);"总是在变化.当我向表单添加更多字段时,数字会增加.
如何获取Selenium IDE中的最后一个元素?例如,如果我添加一个文本字段"changeTeamHint(2156)",如何使用Selenium IDE选择最新的?如果它是2157,它选择2157.等等.
这是我到目前为止所得到的: xpath=(//img[@style='cursor:pointer;'])[last()]
但我的同事告诉我试图通过onclick找到它,这就是我得到的有效: xpath=(//img[@onclick='changeTeamHint(2155);'])[last()]
我试过:xpath=(//img[@onclick='changeTeamHint();'])[last()]但它给了我一个错误
我的测试运行得太快,代码总是失败.有没有办法暂停?
我试过$ this-> pause('3000'); 和$ this-> wait('3000'); 但它不起作用.
现在,我正在使用$ this-> setSpeed('3000'); 但它运行得太慢了.
我正在测试一个网站的下拉菜单,按名称排序.
$nameSort = array();
$numOfNames = $this->getXpathCount("//td[@class='entry']");
for($count = 1; $count <= $numOfNames; $count ++) {
$get = $this->getText("xpath=(//td/a[contains(@href, '')])[$count]");
array_push($nameSort, $get);
}
$test = sort($entrySort);
$this->assertEquals($entrySort, $test);
Run Code Online (Sandbox Code Playgroud)
但它说"有1次失败:
NameTest::testNameTab true does not match expected type "array".