Skip to content
Snippets Groups Projects
Commit 69363f40 authored by srosse's avatar srosse
Browse files

no-jira: change how position are calculated in Selenium for Chrome

parent d8a916af
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,6 @@ import java.util.List;
import org.olat.ims.qti21.model.xml.AssessmentItemFactory;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
/**
*
......@@ -67,36 +66,28 @@ public class Position {
y = (y2 + y1) / 2;
}
if(browser instanceof FirefoxDriver) {
x = x - Math.round(dimension.getWidth() / 2.0f);
y = y - Math.round(dimension.getHeight() / 2.0f);
}
x = x - Math.round(dimension.getWidth() / 2.0f);
y = y - Math.round(dimension.getHeight() / 2.0f);
return new Position(x, y);
}
public static Position valueOf(int x, int y, Dimension dimension, WebDriver browser) {
if(browser instanceof FirefoxDriver) {
x = x - Math.round(dimension.getWidth() / 2.0f);
y = y - Math.round(dimension.getHeight() / 2.0f);
}
x = x - Math.round(dimension.getWidth() / 2.0f);
y = y - Math.round(dimension.getHeight() / 2.0f);
return new Position(x, y);
}
public static Position valueOf(int x, int y, int firefoxCorrection, Dimension dimension, WebDriver browser) {
if(browser instanceof FirefoxDriver) {
x = x - Math.round(dimension.getWidth() / 2.0f);
y = y - Math.round(dimension.getHeight() / 2.0f);
x += firefoxCorrection;
y += firefoxCorrection;
}
x = x - Math.round(dimension.getWidth() / 2.0f);
y = y - Math.round(dimension.getHeight() / 2.0f);
x += firefoxCorrection;
y += firefoxCorrection;
return new Position(x, y);
}
public static Position valueOf(int x, int y, int width, int height, WebDriver browser) {
if(browser instanceof FirefoxDriver) {
x = x - Math.round(width / 2.0f);
y = y - Math.round(height / 2.0f);
}
x = x - Math.round(width / 2.0f);
y = y - Math.round(height / 2.0f);
return new Position(x, y);
}
......
......@@ -27,7 +27,6 @@ import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import uk.ac.ed.ph.jqtiplus.value.Cardinality;
......@@ -82,10 +81,7 @@ public class QTI21HotspotEditorPage extends QTI21AssessmentItemEditorPage {
public QTI21HotspotEditorPage moveToHotspotEditor() {
By editorBy = By.id("o_qti_hotspots_edit");
OOGraphene.waitElement(editorBy, browser);
if(browser instanceof FirefoxDriver) {
OOGraphene.scrollTo(editorBy, browser);
}
OOGraphene.scrollTo(editorBy, browser);
return this;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment