以下代码无效,请帮我保存PDF。我需要将pdf保存在某个位置。
请帮我解决这个问题。 公共类amazonpacking扩展了Dictionary {
static WebDriver driver;
@BeforeTest
public static void before() {
System.setProperty("webdriver.firefox.marionette",
"C:\\selenium\\geckodriver.exe");
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get(AmazonURL);
}
@Test(priority = 0)
public void Amazon() throws InterruptedException {
driver.findElement(By.id("ap_email")).sendKeys("mandkanw@gmail.com");
driver.findElement(By.id("ap_password")).sendKeys("*****");
Thread.sleep(1000);
driver.findElement(By.id("signInSubmit")).click();
Alert alert = driver.switchTo().alert();
alert.accept();
Robot robot = null;
try {
robot = new Robot();
} catch (AWTException e) {
e.printStackTrace();
}
robot.delay(5000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.keyPress(KeyEvent.VK_ESCAPE);
robot.keyRelease(KeyEvent.VK_ESCAPE);
}
}