Skip to content

Commit

Permalink
fix: schedule job bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tianlu-root committed Jan 4, 2022
1 parent 9bf6e75 commit 8a322ec
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/src/main/java/datart/core/common/WebUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ public static <T> T screenShot(String url, OutputType<T> outputType, int imageWi
ExpectedCondition<WebElement> ConditionOfHeight = ExpectedConditions.presenceOfElementLocated(By.id("height"));
wait.until(ExpectedConditions.and(ConditionOfSign, ConditionOfWidth, ConditionOfHeight));

int contentWidth = Integer.parseInt(webDriver.findElement(By.id("width")).getAttribute("value"));
Double contentWidth = Double.parseDouble(webDriver.findElement(By.id("width")).getAttribute("value"));

int contentHeight = Integer.parseInt(webDriver.findElement(By.id("height")).getAttribute("value"));
Double contentHeight = Double.parseDouble(webDriver.findElement(By.id("height")).getAttribute("value"));

if (imageWidth != contentWidth) {
// scale the window
webDriver.manage().window().setSize(new Dimension(imageWidth, contentHeight));
webDriver.manage().window().setSize(new Dimension(imageWidth, contentHeight.intValue()));
Thread.sleep(1000);
}
// scale the window again
contentWidth = Integer.parseInt(webDriver.findElement(By.id("width")).getAttribute("value"));
contentHeight = Integer.parseInt(webDriver.findElement(By.id("height")).getAttribute("value"));
webDriver.manage().window().setSize(new Dimension(contentWidth, contentHeight));
contentWidth = Double.parseDouble(webDriver.findElement(By.id("width")).getAttribute("value"));
contentHeight = Double.parseDouble(webDriver.findElement(By.id("height")).getAttribute("value"));
webDriver.manage().window().setSize(new Dimension(contentWidth.intValue(), contentHeight.intValue()));
Thread.sleep(1000);

TakesScreenshot screenshot = (TakesScreenshot) webDriver;
Expand Down

0 comments on commit 8a322ec

Please sign in to comment.