List of usage examples for org.openqa.selenium WebDriver getCurrentUrl
String getCurrentUrl();
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs//from w ww .j av a 2 s . c o m */ @Test public void clickNestedButtonElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <button id='theButton'></button>\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement button = driver.findElement(By.id("theButton")); assertEquals("button", button.getTagName()); button.click(); assertEquals(URL_FIRST + "page2.html", driver.getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs//from www. jav a 2 s . com */ @Test @Alerts(DEFAULT = "", FF = "page2.html") public void clickNestedCheckboxElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <input type='checkbox' id='theCheckbox' name='myCheckbox' value='Milk'>\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement checkbox = driver.findElement(By.id("theCheckbox")); assertEquals("input", checkbox.getTagName()); checkbox.click(); assertEquals(URL_FIRST + getExpectedAlerts()[0], driver.getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs//from w w w .ja va 2s. c o m */ @Test public void clickNestedImageElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <img id='theImage' src='test.png' />\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement img = driver.findElement(By.id("theImage")); assertEquals("img", img.getTagName()); img.click(); assertEquals(URL_FIRST + "page2.html", driver.getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs/*from w w w. j a va 2 s . com*/ */ @Test @Alerts(DEFAULT = "page2.html", IE = "") public void clickNestedInputImageElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <input type='image' id='theInput' />\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement input = driver.findElement(By.id("theInput")); assertEquals("input", input.getTagName()); input.click(); assertEquals(URL_FIRST + getExpectedAlerts()[0], driver.getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs/* w ww .jav a 2 s . c o m*/ */ @Test @Alerts(DEFAULT = "page2.html", IE = "") public void clickNestedInputTextElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <input type='text' id='theInput' />\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement input = driver.findElement(By.id("theInput")); assertEquals("input", input.getTagName()); input.click(); assertEquals(URL_FIRST + getExpectedAlerts()[0], driver.getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs//from w w w .java 2 s . c o m */ @Test @Alerts(DEFAULT = "page2.html", IE = "") public void clickNestedInputPasswordElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <input type='password' id='theInput' />\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement input = driver.findElement(By.id("theInput")); assertEquals("input", input.getTagName()); input.click(); assertEquals(URL_FIRST + getExpectedAlerts()[0], driver.getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs/* w w w.j a v a 2 s . c o m*/ */ @Test public void clickNestedOptionElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <select>\n" + " <option id='theOption'>test</option>\n" + " </select>\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement option = driver.findElement(By.id("theOption")); assertEquals("option", option.getTagName()); option.click(); assertEquals(URL_FIRST + "page2.html", driver.getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs/* w w w .j a va 2 s . c o m*/ */ @Test @Alerts(DEFAULT = "", FF = "page2.html") public void clickNestedRadioElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <input type='radio' id='theRadio' name='myRadio' value='Milk'>\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement radio = driver.findElement(By.id("theRadio")); assertEquals("input", radio.getTagName()); radio.click(); assertEquals(URL_FIRST + getExpectedAlerts()[0], driver.getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs// w w w . j a va 2s .c om */ @Test @Alerts("page2.html") public void clickNestedResetElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <input type='reset' id='theInput' />\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement input = driver.findElement(By.id("theInput")); assertEquals("input", input.getTagName()); input.click(); assertEquals(URL_FIRST + getExpectedAlerts()[0], driver.getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
License:Apache License
/** * @throws Exception if an error occurs//from w w w . j a v a 2 s. c o m */ @Test @Alerts("page2.html") public void clickNestedSubmitElement() throws Exception { final String html = "<html>\n" + "<body>\n" + " <a href='page2.html'>\n" + " <input type='submit' id='theInput' />\n" + " </a>\n" + "</body></html>"; getMockWebConnection().setDefaultResponse(""); final WebDriver driver = loadPage2(html); final WebElement input = driver.findElement(By.id("theInput")); assertEquals("input", input.getTagName()); input.click(); assertEquals(URL_FIRST + getExpectedAlerts()[0], driver.getCurrentUrl()); }