|
@@ -183,6 +183,8 @@ public class AppiumJobServiceImpl extends ServiceImpl<AppiumJobMapper, AppiumJob
|
|
appiumTaskLogMapper.insert(log);
|
|
appiumTaskLogMapper.insert(log);
|
|
log.setId(log.getId());
|
|
log.setId(log.getId());
|
|
try {
|
|
try {
|
|
|
|
+ //一键新机
|
|
|
|
+ boolean success = refreshWebPhone();
|
|
String ksId = loginTask(2L);
|
|
String ksId = loginTask(2L);
|
|
if (null == ksId) {
|
|
if (null == ksId) {
|
|
updateStatus(appiumDevice, log, -1, 1);
|
|
updateStatus(appiumDevice, log, -1, 1);
|
|
@@ -203,6 +205,57 @@ public class AppiumJobServiceImpl extends ServiceImpl<AppiumJobMapper, AppiumJob
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public boolean refreshWebPhone() {
|
|
|
|
+ boolean success = false;
|
|
|
|
+ String url = "https://lcloud.longene.com.cn/";
|
|
|
|
+ System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
|
|
|
|
+ ChromeOptions chromeOptions = new ChromeOptions();
|
|
|
|
+// chromeOptions.addArguments("--headless");
|
|
|
|
+ chromeOptions.addArguments("--incognito");
|
|
|
|
+ chromeOptions.addArguments("--disable-gpu");
|
|
|
|
+// chromeOptions.addArguments("--no-sandbox");
|
|
|
|
+ chromeOptions.addArguments("--window-size=1920,1080");
|
|
|
|
+ chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
|
|
|
|
+ chromeOptions.setAcceptInsecureCerts(true);
|
|
|
|
+ WebDriver webDriver = new ChromeDriver(chromeOptions);
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(3000L);
|
|
|
|
+ HttpUtils2.cookieStore = new BasicCookieStore();
|
|
|
|
+ webDriver.manage().deleteAllCookies();
|
|
|
|
+ //获取登录页面
|
|
|
|
+ webDriver.get(url);
|
|
|
|
+ Thread.sleep(3000L);
|
|
|
|
+ WebElement accountElement = webDriver.findElement(By.id("username"));
|
|
|
|
+ accountElement.sendKeys("18600471989");
|
|
|
|
+ Thread.sleep(3000L);
|
|
|
|
+ WebElement passwordElement = webDriver.findElement(By.id("userpwd"));
|
|
|
|
+ passwordElement.sendKeys("0759125184xu");
|
|
|
|
+ WebElement loginElement = webDriver.findElement(By.xpath("//input[@class='quc-submit quc-button quc-button-primary quc-button-sign-in']"));
|
|
|
|
+ Thread.sleep(3000L);
|
|
|
|
+ //点击登录
|
|
|
|
+ loginElement.click();
|
|
|
|
+ Thread.sleep(3000L);
|
|
|
|
+ //选择华东二站
|
|
|
|
+ WebElement spreadElement = webDriver.findElement(By.xpath("//a[@href='javascript:gotobranch(2)']"));
|
|
|
|
+ spreadElement.click();
|
|
|
|
+ Thread.sleep(3000L);
|
|
|
|
+ //
|
|
|
|
+ webDriver.get("https://ecsite.longene.com.cn/userWeb!batchipswitch?ids=4293&groupid=8729&mode=5&ipbind=0®ion=0&ipareas=");
|
|
|
|
+ Thread.sleep(5000L);
|
|
|
|
+ webDriver.get("https://ecsite.longene.com.cn/userWeb!batchnewphone?groupid=8729&pkgnames=com.smile.gifmaker&ids=4293");
|
|
|
|
+ Thread.sleep(5000L);
|
|
|
|
+ success = true;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ log.error("一键新机操作失败");
|
|
|
|
+ } finally {
|
|
|
|
+ webDriver.manage().deleteAllCookies();
|
|
|
|
+ webDriver.close();
|
|
|
|
+ return success;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private void updateStatus(AppiumDevice appiumDevice, AppiumTaskLog log, Integer logStatus, Integer deviceStatus) {
|
|
private void updateStatus(AppiumDevice appiumDevice, AppiumTaskLog log, Integer logStatus, Integer deviceStatus) {
|
|
log.setStatus(3);
|
|
log.setStatus(3);
|
|
appiumTaskLogMapper.updateById(log);
|
|
appiumTaskLogMapper.updateById(log);
|