摘要: 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... 阅读全文
posted @ 2013-08-24 22:43 苦逼IT男 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2013-08-24 20:42 苦逼IT男 阅读(170) 评论(0) 推荐(0) 编辑
摘要: /**显示等待并返回元素 * @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 ... 阅读全文
posted @ 2013-08-24 20:30 苦逼IT男 阅读(228) 评论(0) 推荐(0) 编辑
摘要: @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... 阅读全文
posted @ 2013-08-24 20:02 苦逼IT男 阅读(2132) 评论(0) 推荐(0) 编辑
摘要: @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... 阅读全文
posted @ 2013-08-24 19:35 苦逼IT男 阅读(706) 评论(0) 推荐(0) 编辑
摘要: /**截图 * @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:\\"... 阅读全文
posted @ 2013-08-24 17:25 苦逼IT男 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2013-08-24 17:04 苦逼IT男 阅读(1594) 评论(0) 推荐(0) 编辑
摘要: @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(); ... 阅读全文
posted @ 2013-08-24 17:00 苦逼IT男 阅读(393) 评论(0) 推荐(0) 编辑
摘要: static final WebDriver driver = ExplorerBase.IESetting(); // 实例化一个浏览器对象 @Test //@Ignore public void findBaiDuElements() { try { Thread.sleep(500); } catch (InterruptedException e1) { e1.printStackTrace(); } driver.manage().window().maxim... 阅读全文
posted @ 2013-08-24 16:58 苦逼IT男 阅读(393) 评论(0) 推荐(0) 编辑
摘要: /**模拟鼠标悬浮在某元素上 * @param driver * @param locator */ public static void moveToElement(WebDriver driver, By locator) { Actions ... 阅读全文
posted @ 2013-08-24 16:55 苦逼IT男 阅读(4189) 评论(0) 推荐(0) 编辑