|
@@ -18,6 +18,7 @@ import org.openqa.selenium.support.ui.WebDriverWait;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
+import java.time.Duration;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
@@ -34,20 +35,20 @@ public class BimFaceCheckUtil {
|
|
|
options.addArguments("--headless");
|
|
|
options.addArguments("--no-sandbox");
|
|
|
options.addArguments("--disable-gpu");
|
|
|
- options.addArguments("--disable-dev-shm-usage"); //初始化一个chrome浏览器实例
|
|
|
+ options.addArguments("--disable-dev-shm-usage");
|
|
|
options.setBinary(bimConfig.getChromeDriver());
|
|
|
WebDriver driver = new ChromeDriver(options);
|
|
|
//最大化窗口
|
|
|
// driver.manage().window().maximize();
|
|
|
//设置隐性等待时间
|
|
|
- driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
|
|
|
+ driver.manage().timeouts().implicitlyWait( Duration.ofMinutes(2));
|
|
|
//打开百度
|
|
|
driver.get("https://bimface.com/user-console/login");
|
|
|
driver.findElement(By.xpath("//*[@id=\"container-login\"]/div/div[3]/div[1]/div[2]/input")).sendKeys("18666146602");
|
|
|
driver.findElement(By.xpath("//*[@id=\"container-login\"]/div/div[3]/div[1]/div[4]/input")).sendKeys("4dage168");
|
|
|
driver.findElement(By.xpath("//*[@id=\"container-login\"]/div/div[3]/button")).click();
|
|
|
Thread.sleep(5000);
|
|
|
- new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\"app\"]/section/header/div/ul/div/li[2]"))).click();
|
|
|
+ new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\"app\"]/section/header/div/ul/div/li[2]"))).click();
|
|
|
Thread.sleep(5000);
|
|
|
String integral = driver.findElement(By.xpath("//*[@id=\"app\"]/section/section/main/div[1]/div[2]/div/div/div[1]/div[2]/span[2]")).getText();
|
|
|
log.info("剩余积分{}",integral);
|