为什么Selenium 3.0中的Firefox驱动程序存在这么多问题?
当我尝试使用Action类时,它没有上下文点击(右键单击),而且我也尝试从它不选择的列表中选择多个选项。
public class MultipleSelect {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\Saurabh\\Driver\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://jqueryui.com/selectable/");
driver.switchTo().frame(0);
List<WebElement> selectOption = driver.findElements(By.xpath("html/body/ol/li"));
Actions act=new Actions(driver);
driver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);
System.out.println(selectOption.size());
act.keyDown(Keys.CONTROL).perform();
for(int i=1;i<8;i++) {
if(i%2==0) {
act.click(selectOption.get(i-1)).perform();
System.out.println(selectOption.get(i-1).getText()+" is Selected");
Thread.sleep(2000);
}
}
driver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);
driver.close();
}
}