List of usage examples for org.openqa.selenium WebDriver getTitle
String getTitle();
From source file:com.gargoylesoftware.htmlunit.javascript.host.CharacterDataImplTest.java
License:Apache License
/** * Regression test for inline text nodes. * @throws Exception if the test fails/*from w w w . j av a 2 s. c o m*/ */ @Test @Alerts({ "Some Text", "9", "3", "Some Text", "#text" }) public void characterDataImpl_textNode() throws Exception { final String html = "<html><head><title>First</title><script>\n" + "function doTest() {\n" + " var div1=document.getElementById('div1');\n" + " var text1=div1.firstChild;\n" + " alert(text1.data);\n" + " alert(text1.length);\n" + " alert(text1.nodeType);\n" + " alert(text1.nodeValue);\n" + " alert(text1.nodeName);\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<div id='div1'>Some Text</div></body></html>"; final WebDriver driver = loadPageWithAlerts2(html); assertEquals("First", driver.getTitle()); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.CharacterDataImplTest.java
License:Apache License
/** * Regression test for setting the data property of a text node. * @throws Exception if the test fails//from www . ja va 2 s. co m */ @Test @Alerts({ "Some New Text", "Some New Text" }) public void characterDataImpl_setData() throws Exception { final String html = "<html><head><title>First</title><script>\n" + "function doTest() {\n" + " var div1=document.getElementById('div1');\n" + " var text1=div1.firstChild;\n" + " text1.data='Some New Text';\n" + " alert(text1.data);\n" + " alert(text1.nodeValue);\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<div id='div1'>Some Text</div></body></html>"; final WebDriver driver = loadPageWithAlerts2(html); assertEquals("First", driver.getTitle()); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.CharacterDataImplTest.java
License:Apache License
/** * Regression test for setting the nodeValue property of a text node. * @throws Exception if the test fails/*from w ww.java 2 s . co m*/ */ @Test @Alerts({ "Some New Text", "Some New Text" }) public void characterDataImpl_setNodeValue() throws Exception { final String html = "<html><head><title>First</title><script>\n" + "function doTest() {\n" + " var div1=document.getElementById('div1');\n" + " var text1=div1.firstChild;\n" + " text1.nodeValue='Some New Text';\n" + " alert(text1.data);\n" + " alert(text1.nodeValue);\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<div id='div1'>Some Text</div></body></html>"; final WebDriver driver = loadPageWithAlerts2(html); assertEquals("First", driver.getTitle()); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.CharacterDataImplTest.java
License:Apache License
/** * Regression test for appendData of a text node. * @throws Exception if the test fails//from w ww. ja v a 2s.c o m */ @Test @Alerts("Some Text Appended") public void characterDataImpl_appendData() throws Exception { final String html = "<html><head><title>First</title><script>\n" + "function doTest() {\n" + " var div1=document.getElementById('div1');\n" + " var text1=div1.firstChild;\n" + " text1.appendData(' Appended');\n" + " alert(text1.data);\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<div id='div1'>Some Text</div></body></html>"; final WebDriver driver = loadPageWithAlerts2(html); assertEquals("First", driver.getTitle()); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.CharacterDataImplTest.java
License:Apache License
/** * Regression test for deleteData of a text node. * @throws Exception if the test fails//w w w . jav a 2 s.c o m */ @Test @Alerts("Some Text") public void characterDataImpl_deleteData() throws Exception { final String html = "<html><head><title>First</title><script>\n" + "function doTest() {\n" + " var div1=document.getElementById('div1');\n" + " var text1=div1.firstChild;\n" + " text1.deleteData(5, 11);\n" + " alert(text1.data);\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<div id='div1'>Some Not So New Text</div></body></html>"; final WebDriver driver = loadPageWithAlerts2(html); assertEquals("First", driver.getTitle()); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.CharacterDataImplTest.java
License:Apache License
/** * Regression test for insertData of a text node. * @throws Exception if the test fails/* ww w .java 2 s . c om*/ */ @Test @Alerts("Some New Text") public void characterDataImpl_insertData() throws Exception { final String html = "<html><head><title>First</title><script>\n" + "function doTest() {\n" + " var div1=document.getElementById('div1');\n" + " var text1=div1.firstChild;\n" + " text1.insertData(5, 'New ');\n" + " alert(text1.data);\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<div id='div1'>Some Text</div></body></html>"; final WebDriver driver = loadPageWithAlerts2(html); assertEquals("First", driver.getTitle()); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.CharacterDataImplTest.java
License:Apache License
/** * Regression test for replaceData of a text node. * @throws Exception if the test fails/*from w w w .jav a 2 s. c o m*/ */ @Test @Alerts("Some New Text") public void characterDataImpl_replaceData() throws Exception { final String html = "<html><head><title>First</title><script>\n" + "function doTest() {\n" + " var div1=document.getElementById('div1');\n" + " var text1=div1.firstChild;\n" + " text1.replaceData(5, 3, 'New');\n" + " alert(text1.data);\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<div id='div1'>Some Old Text</div></body></html>"; final WebDriver driver = loadPageWithAlerts2(html); assertEquals("First", driver.getTitle()); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.CharacterDataImplTest.java
License:Apache License
/** * Regression test for substringData of a text node. * @throws Exception if the test fails/* w w w .j a v a 2s.co m*/ */ @Test @Alerts({ "New", "Some New Text" }) public void characterDataImpl_substringData() throws Exception { final String html = "<html><head><title>First</title><script>\n" + "function doTest() {\n" + " var div1=document.getElementById('div1');\n" + " var text1=div1.firstChild;\n" + " alert(text1.substringData(5, 3));\n" + " alert(text1.data);\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<div id='div1'>Some New Text</div></body></html>"; final WebDriver driver = loadPageWithAlerts2(html); assertEquals("First", driver.getTitle()); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.CharacterDataImplTest.java
License:Apache License
/** * Regression test for substringData of a text node. * @throws Exception if the test fails/*from w w w . j av a2s .c om*/ */ @Test @Alerts({ "Some ", "Text", "true" }) public void textImpl_splitText() throws Exception { final String html = "<html><head><title>First</title><script>\n" + "function doTest() {\n" + " var div1=document.getElementById('div1');\n" + " var text1=div1.firstChild;\n" + " var text2=text1.splitText(5);\n" + " alert(text1.data);\n" + " alert(text2.data);\n" + " alert(text1.nextSibling==text2);\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<div id='div1'>Some Text</div></body></html>"; final WebDriver driver = loadPageWithAlerts2(html); assertEquals("First", driver.getTitle()); }
From source file:com.gargoylesoftware.htmlunit.javascript.host.DocumentTest.java
License:Apache License
/** * @throws Exception if the test fails/* www . java 2 s . co m*/ */ @Test @Alerts(DEFAULT = { "", "second" }, CHROME = { "URL", "second" }) public void formArray() throws Exception { final String firstHtml = "<html><head><SCRIPT lang='JavaScript'>\n" + " function doSubmit(formName){\n" + " var form = document.forms[formName];\n" // This line used to blow up + " form.submit()\n" + "}\n" + "</SCRIPT></head><body><form name='formName' method='POST' " + "action='" + URL_SECOND + "'>\n" + "<a href='.' id='testJavascript' name='testJavascript' " + "onclick=\" doSubmit('formName');return false;\">\n" + "Test Link </a><input type='submit' value='Login' " + "name='loginButton'></form>\n" + "</body></html> "; final String secondHtml = "<html><head><title>second</title></head><body>\n" + "<p>hello world</p>\n" + "</body></html>"; getMockWebConnection().setResponse(URL_SECOND, secondHtml); expandExpectedAlertsVariables(URL_FIRST); final WebDriver driver = loadPage2(firstHtml); assertEquals(getExpectedAlerts()[0], driver.getTitle()); driver.findElement(By.id("testJavascript")).click(); assertEquals(getExpectedAlerts()[1], driver.getTitle()); }