使用webdriver操作元素时候,有的时候需要使用xpath去定位页面元素。记录一下最近使用到的两个例子:
1.查找页面内
rightFrame.findElement(By.xpath(".//input[@value='提交']")).click();
WebElement ele=driver.findElement(By.xpath("//input[@*='fuck']"));
2.查找一个table元素,class name = xxx
site.findElement(By.xpath("//table[@class='ui_border ui_state_visible ui_state_focus ui_state_lock']")
//主要参考了