摘要:
Connection con=null; PreparedStatement ps=null; ResultSet rs=null; try { //建立连接 con= JDBCUtils.getConnection(); //创建语句 String sql="insert into t_user values('test','123',null,null)"; ps = con.prepareStatement... 阅读全文
摘要:
ITeye:http://shijincheng0223.iteye.com/blog/1481446 http://ztreeapi.iteye.com/blog/1750554http://smilejay.com/2012/09/selenium-webdriver-with-ie/http://uniquepig.iteye.com/blog/1703553http://wenku.baidu.com/view/a5d218cdb14e852458fb571c.html?pn=51 阅读全文
摘要:
/**显示等待并返回元素 * @param driver * @param locator */ public static WebElement showWait(WebDriver driver, final String locator) { return new WebDriverWait(driver, 10).until(new ExpectedCondition() { public WebElement apply(WebDriver ... 阅读全文
摘要:
@Test public void testRadio() { WebDriver driver = ExplorerBase.IESetting(); try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } driver.manage().window().maxim... 阅读全文
摘要:
@Test public void test() { WebDriver driver=ExplorerBase.IESetting(); driver.get("http://uniquepig.iteye.com/signup"); driver.manage().window().maximize(); //在读学生 Select select = new Select(driver.findElement(By.id("user_gender"))); select.selectByVisible... 阅读全文
摘要:
/**截图 * @param driver * @param name */ public static void takeScreenShot(WebDriver driver,String name){ File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); try { FileUtils.copyFile(scrFile, new File("c:\\"... 阅读全文
摘要:
public class BaiduTest { private WebDriver driver; private String baseUrl; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = ExplorerBase.IESetting(); baseUrl = "http://www.baidu.com/"; driver.manage().timeouts().impli... 阅读全文
摘要:
@Test public void testElementByID() { //通过JS获取页面元素 driver.get(url); driver.manage().window().maximize(); try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); ... 阅读全文
摘要:
static final WebDriver driver = ExplorerBase.IESetting(); // 实例化一个浏览器对象 @Test //@Ignore public void findBaiDuElements() { try { Thread.sleep(500); } catch (InterruptedException e1) { e1.printStackTrace(); } driver.manage().window().maxim... 阅读全文
摘要:
/**模拟鼠标悬浮在某元素上 * @param driver * @param locator */ public static void moveToElement(WebDriver driver, By locator) { Actions ... 阅读全文
摘要:
/** * 判断元素是否存在 * * @param driver * @param by * @return */ public static boolean isElementPresent(WebDriver driver, By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; ... 阅读全文
摘要:
public static FirefoxDriver FFSetting() { System.setProperty("webdriver.firefox.bin", "D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); return new FirefoxDriver(); } public static InternetExplorerDriver IESetting() { System.setProperty("webdriver... 阅读全文