标签:测试
package com.ehealth.cm; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class IFPVirusScan { public static void main(String[] args) { WebDriver d=new FirefoxDriver(); d.get("https://www.qa.ehealthinsurance.com"); System.out.println("Ready to click.."); d.findElement(By.linkText("Sign in")).click(); System.out.println("CLick...ready to send keys..."); d.findElement(By.id("email")).sendKeys("xxxx@example.com"); d.findElement(By.id("password")).sendKeys("xxxxxx"); System.out.println("send keys success.."); d.findElement(By.id("btn-sign-in")).click(); System.out.println("Login success...Ready to click view detail"); d.findElement(By.xpath(".//*[@id=‘content‘]/section[1]/block[3]/block/div[1]/a/span")).click(); d.findElement(By.xpath(".//*[@id=‘content‘]/section[1]/block[3]/div[1]")).click(); WebElement e=d.findElement(By.id("file-upload")); e.sendKeys("C:\\Eicar Exempt\\03G101-1 平面表示法(修订版)LSK 10MB.pdf"); d.findElement(By.xpath(".//*[@id=‘account-center‘]/block/div[2]/section/block/block/div[2]")).click(); System.out.println("success."); } }
两个问题:
等待时间太长
怎么点击提示的弹窗?
本文出自 “ehealth” 博客,谢绝转载!
selenium学习------自动化上传病毒特征文件测试脚本
标签:测试
原文地址:http://ehealth.blog.51cto.com/10942284/1723098