diff --git a/src/test/java/com/aerokube/selenoid/TestAttributes.java b/src/test/java/com/aerokube/selenoid/TestAttributes.java index 56a6411..27ce3ab 100644 --- a/src/test/java/com/aerokube/selenoid/TestAttributes.java +++ b/src/test/java/com/aerokube/selenoid/TestAttributes.java @@ -17,14 +17,14 @@ public class TestAttributes extends TestBase { @Before public void before() throws Exception { openPage(Page.SECOND); - waitUntilElementIsPresent(By.id("test-id")); + waitUntilElementIsPresent(By.cssSelector("#test-id")); } @Features("Capability to get element attributes") @Test public void testGetAttributes() throws Exception { WebDriver driver = getDriver(); - WebElement div = driver.findElement(By.id("test-id")); + WebElement div = driver.findElement(By.cssSelector("#test-id")); assertThat(div.getSize().getWidth(), equalTo(100)); assertThat(div.getSize().getHeight(), equalTo(100)); assertThat(div.getLocation().getX(), equalTo(100)); diff --git a/src/test/java/com/aerokube/selenoid/TestCookies.java b/src/test/java/com/aerokube/selenoid/TestCookies.java index 53c0769..f17a8e8 100644 --- a/src/test/java/com/aerokube/selenoid/TestCookies.java +++ b/src/test/java/com/aerokube/selenoid/TestCookies.java @@ -13,12 +13,12 @@ import static org.junit.Assert.assertThat; public class TestCookies extends TestBase { - + @Before public void before() throws Exception { openPage(Page.FIRST); - waitUntilElementIsPresent(By.id("test-id")); + waitUntilElementIsPresent(By.cssSelector("#test-id")); } @Features("Working with cookies") @@ -39,5 +39,5 @@ public void testCookie() throws Exception { fail("Cookies are not supported", e); } } - + } diff --git a/src/test/java/com/aerokube/selenoid/TestDrag.java b/src/test/java/com/aerokube/selenoid/TestDrag.java index 43e992f..2e1f7cb 100644 --- a/src/test/java/com/aerokube/selenoid/TestDrag.java +++ b/src/test/java/com/aerokube/selenoid/TestDrag.java @@ -18,7 +18,7 @@ public class TestDrag extends TestBase { @Before public void before() throws Exception { openPage(Page.DRAG); - waitUntilElementIsPresent(By.id("custom-handle")); + waitUntilElementIsPresent(By.cssSelector("#custom-handle")); } @Features("Drag functionality") @@ -26,7 +26,7 @@ public void before() throws Exception { public void testDrag() throws Exception { try { WebDriver driver = getDriver(); - WebElement button = driver.findElement(By.id("custom-handle")); + WebElement button = driver.findElement(By.cssSelector("#custom-handle")); assertThat(button.getText(), equalTo("10")); Actions drag = new Actions(driver); diff --git a/src/test/java/com/aerokube/selenoid/TestEvaluateJavascript.java b/src/test/java/com/aerokube/selenoid/TestEvaluateJavascript.java index 66f2640..eb76e04 100644 --- a/src/test/java/com/aerokube/selenoid/TestEvaluateJavascript.java +++ b/src/test/java/com/aerokube/selenoid/TestEvaluateJavascript.java @@ -20,7 +20,7 @@ public class TestEvaluateJavascript extends TestBase { @Before public void before() throws Exception { openPage(Page.FIRST); - waitUntilElementIsPresent(By.id("test-id")); + waitUntilElementIsPresent(By.cssSelector("#test-id")); WebDriver driver = getDriver(); assertThat("Javascript execution is not supported", driver, is(instanceOf(JavascriptExecutor.class))); } @@ -42,7 +42,7 @@ public void testEvaluateJavascript() throws Exception { fail("Synchronous javascript execution is not supported", e); } } - + @Features("Asynchronous Javascript evaluation") @Test public void testEvaluateJavascriptAsync() throws Exception { @@ -61,7 +61,7 @@ public void testEvaluateJavascriptAsync() throws Exception { fail("Asynchronous javascript execution is not supported"); } } - + @Features("Window scrolling") @Test public void testScroll() throws Exception { @@ -73,15 +73,15 @@ public void testScroll() throws Exception { fail("Window scrolling is not supported", e); } } - + private String getScript() { return "var div = document.getElementById('test-id'); div.textContent = 'bar';"; } - + private String getAsyncScript() { return "var callback = arguments[arguments.length - 1];" + " var div = document.getElementById('test-id');" + " div.textContent = 'baz'; callback('works');"; } - + } diff --git a/src/test/java/com/aerokube/selenoid/TestFindElement.java b/src/test/java/com/aerokube/selenoid/TestFindElement.java index 3a628a5..aec0328 100644 --- a/src/test/java/com/aerokube/selenoid/TestFindElement.java +++ b/src/test/java/com/aerokube/selenoid/TestFindElement.java @@ -22,7 +22,7 @@ public class TestFindElement extends TestBase { @Before public void before() throws Exception { openPage(Page.FIRST); - waitUntilElementIsPresent(By.id("test-id")); + waitUntilElementIsPresent(By.cssSelector("#test-id")); } @Features("Finding element by CSS selector") @@ -39,7 +39,7 @@ public void testFindByCSSSelector() throws Exception { @Test public void testFindById() throws Exception { WebDriver driver = getDriver(); - List elementsById = driver.findElements(By.id("test-id")); + List elementsById = driver.findElements(By.cssSelector("#test-id")); assertThat(elementsById, hasSize(1)); assertThat(elementsById.get(0).getTagName(), equalToIgnoringCase("div")); assertThat(elementsById.get(0).getText(), equalTo("foo")); @@ -54,7 +54,7 @@ public void testFindByClass() throws Exception { assertThat(elementsByClass.get(0).getTagName(), equalToIgnoringCase("span")); assertThat(elementsByClass.get(0).getText(), equalTo("bar")); } - + @Features("Finding element by XPath expression") @Test public void testFindByXPath() throws Exception { @@ -64,5 +64,5 @@ public void testFindByXPath() throws Exception { assertThat(elementsByXPath.get(0).getTagName(), equalToIgnoringCase("span")); assertThat(elementsByXPath.get(0).getText(), equalTo("bar")); } - + } diff --git a/src/test/java/com/aerokube/selenoid/TestHotkeys.java b/src/test/java/com/aerokube/selenoid/TestHotkeys.java index cdcea50..cb7dcd4 100644 --- a/src/test/java/com/aerokube/selenoid/TestHotkeys.java +++ b/src/test/java/com/aerokube/selenoid/TestHotkeys.java @@ -18,7 +18,7 @@ public class TestHotkeys extends TestBase { @Before public void before() throws Exception { openPage(Page.HOTKEYS); - waitUntilElementIsPresent(By.id("test-id")); + waitUntilElementIsPresent(By.cssSelector("#test-id")); } @Features("Pressing keys on the keyboard") @@ -26,10 +26,10 @@ public void before() throws Exception { public void testHotkeys() { WebDriver driver = getDriver(); String someKeys = Keys.chord(Keys.CONTROL, "c"); - WebElement divTag = driver.findElement(By.id("test-id")); + WebElement divTag = driver.findElement(By.cssSelector("#test-id")); assertThat(divTag.getText(), equalTo("initial")); driver.findElement(By.tagName("html")).sendKeys(someKeys); assertThat(divTag.getText(), equalTo("new")); } - + } diff --git a/src/test/java/com/aerokube/selenoid/TestScreenshot.java b/src/test/java/com/aerokube/selenoid/TestScreenshot.java index a688d26..cf5bf10 100644 --- a/src/test/java/com/aerokube/selenoid/TestScreenshot.java +++ b/src/test/java/com/aerokube/selenoid/TestScreenshot.java @@ -17,7 +17,7 @@ public class TestScreenshot extends TestBase { @Before public void before() throws Exception { openPage(Page.FIRST); - waitUntilElementIsPresent(By.id("test-id")); + waitUntilElementIsPresent(By.cssSelector("#test-id")); } @Features("Taking screenshots") @@ -30,11 +30,11 @@ public void testScreenshot() throws Exception { fail("Screenshots are not supported", e); } } - + @Attachment("screenshot") private byte[] takeScreenshot(WebDriver driver) { return ((TakesScreenshot) new Augmenter().augment(driver)) .getScreenshotAs(OutputType.BYTES); } - + } diff --git a/src/test/java/com/aerokube/selenoid/TestTimeouts.java b/src/test/java/com/aerokube/selenoid/TestTimeouts.java index 0b69f25..e3bf9c3 100644 --- a/src/test/java/com/aerokube/selenoid/TestTimeouts.java +++ b/src/test/java/com/aerokube/selenoid/TestTimeouts.java @@ -16,7 +16,7 @@ public class TestTimeouts extends TestBase { @Before public void before() throws Exception { openPage(Page.FIRST); - waitUntilElementIsPresent(By.id("test-id")); + waitUntilElementIsPresent(By.cssSelector("#test-id")); } @Features("Setting page load timeout") @@ -30,7 +30,7 @@ public void testPageLoadTimeout() throws Exception { fail("Setting page load timeout is not supported", e); } } - + @Features("Setting implicit timeout") @Test public void testImplicitTimeout() throws Exception { @@ -41,7 +41,7 @@ public void testImplicitTimeout() throws Exception { fail("Implicitly waiting is not supported", e); } } - + @Features("Setting script execution timeout") @Test public void testScriptTimeout() throws Exception { diff --git a/src/test/java/com/aerokube/selenoid/TestWindowCommands.java b/src/test/java/com/aerokube/selenoid/TestWindowCommands.java index f94ac08..1d66d70 100644 --- a/src/test/java/com/aerokube/selenoid/TestWindowCommands.java +++ b/src/test/java/com/aerokube/selenoid/TestWindowCommands.java @@ -17,19 +17,19 @@ @Features("Miscellaneous window commands") public class TestWindowCommands extends TestBase { - + @Before public void before() throws Exception { openPage(Page.FIRST); - waitUntilElementIsPresent(By.id("test-id")); + waitUntilElementIsPresent(By.cssSelector("#test-id")); } - + @Features("Closing window") @Test public void testWindowCloseIsSupported() throws Exception { try { WebDriver driver = getDriver(); - WebElement link = driver.findElement(By.id("test-link")); //This link opens new window + WebElement link = driver.findElement(By.cssSelector("#test-link")); //This link opens new window link.click(); await().until(() -> getDriver().getWindowHandles().size() == 2); getDriver().close(); @@ -38,13 +38,13 @@ public void testWindowCloseIsSupported() throws Exception { fail("WebDriver.close() is not supported", e); } } - + @Features("Switching between windows") @Test public void testSwitchWindows() throws Exception { try { WebDriver driver = getDriver(); - WebElement link = driver.findElement(By.id("test-link")); //This link opens new window + WebElement link = driver.findElement(By.cssSelector("#test-link")); //This link opens new window link.click(); await().until(() -> driver.getWindowHandles().size() == 2); List windowNames = driver.getWindowHandles().stream().map(wh -> { @@ -56,20 +56,20 @@ public void testSwitchWindows() throws Exception { fail("Switching between windows is not supported", e); } } - + @Features("Switching between frames") @Test public void testSwitchFrames() throws Exception { try { openPage(Page.FRAMES); WebDriver driver = getDriver(); - WebElement firstFrameElement = driver.findElement(By.id("first")); + WebElement firstFrameElement = driver.findElement(By.cssSelector("#first")); driver.switchTo().frame(firstFrameElement); WebElement firstFrame = driver.switchTo().activeElement(); assertThat(firstFrame.findElements(By.cssSelector("span.test-class")), hasSize(1)); - + driver.switchTo().defaultContent(); - WebElement secondFrameElement = driver.findElement(By.id("second")); + WebElement secondFrameElement = driver.findElement(By.cssSelector("#second")); driver.switchTo().frame(secondFrameElement); WebElement secondFrame = driver.switchTo().activeElement(); assertThat(secondFrame.findElements(By.cssSelector("div#test-id")), hasSize(1)); @@ -78,7 +78,7 @@ public void testSwitchFrames() throws Exception { fail("Switching between frames is not supported", e); } } - + @Features("Navigating back and forward") @Test public void testBackAndForward() throws Exception { @@ -91,7 +91,7 @@ public void testBackAndForward() throws Exception { driver.navigate().forward(); assertThat(getPageTitle(), equalTo("second")); } - + @Features("Screen orientation support") @Ignore @Test @@ -108,5 +108,5 @@ public void testScreenOrientation() { fail("This driver does not support rotation", e); } } - + }