嗨,这是下面的代码: 我想要做的是构建一个函数,在其中我只传递 XPath 的值,所以我不必driver.findElement(By.xpath(""))
一次又一次地编写。
driver.findElement(By.xpath("//*[@id='lead_source']")).sendKeys("Existing Customer");
driver.findElement(By.xpath("//*[@id='date_closed']")).sendKeys("08/07/2013");
driver.findElement(By.xpath("//*[@id='sales_stage']")).sendKeys("Opportuntiy Qualification");
driver.findElement(By.xpath("//*[@id='opportunity_monthly_volume']")).sendKeys("10895");
driver.findElement(By.xpath("//*[@id='probability']")).sendKeys("90");
driver.findElement(By.xpath("//*[@id='opportunity_sales_rep']")).sendKeys("Sales Rep");
driver.findElement(By.xpath("//*[@id='opportunity_sales_regions']")).sendKeys("Northeast");
driver.findElement(By.xpath("//*[@id='opportunity_current_lab']")).sendKeys("Current lab");
driver.findElement(By.cssSelector(Payermixcss +"opportunity_medicare")).sendKeys("5");