Created
March 19, 2015 12:46
-
-
Save ddavison/e8c9dd1127b84f8f6e08 to your computer and use it in GitHub Desktop.
WebElement caching?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.junit.Before; | |
| import org.junit.Test; | |
| import org.openqa.selenium.By; | |
| import org.openqa.selenium.WebElement; | |
| import org.openqa.selenium.chrome.ChromeDriver; | |
| /** | |
| * @author ddavison | |
| * @since Mar 18, 2015 | |
| */ | |
| public class TestSelenium { | |
| private ChromeDriver driver = null; | |
| @Before | |
| public void before() { | |
| System.setProperty("webdriver.chrome.driver", "chromedriver"); | |
| driver = new ChromeDriver(); | |
| } | |
| @Test | |
| public void testAttribute() { | |
| driver.get("http://ddavison.io/tests/getting-started-with-selenium.htm"); | |
| WebElement box = driver.findElement(By.id("click")); | |
| System.out.println("class: " + box.getAttribute("class")); // class: box | |
| box.click(); | |
| System.out.println("class: " + box.getAttribute("class")); // class: box success | |
| // therefore, it *is* polling dom again. i.e, it's not caching it. | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment