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("[email protected]"); 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."); } }
两个问题:
- 等待时间太长
- 怎么点击提示的弹窗?
时间: 2024-10-08 16:53:24