我正在使用 JDev 运行一个 java 转换的 selenium 2.0 脚本。我有一个案例,我打开一个模式窗口并搜索一个类似的字符串%SomeText%
,它会在它下面产生一个记录,w/n 相同的窗口。现在,我想确保它产生了我正在寻找的文本,如果我得到该文本,请在模态窗口中单击“确定”。任何想法如何做到这一点......我正在做以下事情:
//this is working
driver.findElement(By.id("_afrFilterpt1_afr__UISatr_afr_0_afr_AT1_afr__ATp_afr_t2_afr_c3::content")).sendKeys(Keys.RETURN);
//this doesn't work, text given here is part of the text which is returned after search
assertTrue((driver.findElements(By.xpath("contains(text(),'Approved:Create Grade Ladder (AU_New Grade Ladder205, 2012-08-31)')")).size() > 0) ? true:false);
//this works if above line is deleted, else this also does not work
driver.findElement(By.xpath("//button[text()='OK']")).click();