-
-
Save esfand/c3c1f8a682756c60a99a to your computer and use it in GitHub Desktop.
This file contains 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
require 'selenium-webdriver' | |
d = Selenium::WebDriver.for :chrome | |
e = d.find_element(:id, "divHidden") | |
text = d.execute_script("return arguments[0].innerHTML", e) | |
e = d.find_element(:id, "divDisplayNone") | |
text = d.execute_script("return arguments[0].innerHTML", e) |
This file contains 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
package selenium; | |
import java.sql.Driver; | |
import java.util.List; | |
import java.util.concurrent.TimeUnit; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.support.ui.ExpectedConditions; | |
import org.openqa.selenium.support.ui.Wait; | |
import org.openqa.selenium.support.ui.WebDriverWait; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.JavascriptExecutor; | |
import org.openqa.selenium.firefox.FirefoxDriver;; | |
public class test { | |
private static WebDriver driver; | |
public static void main(String[] args) { | |
driver = new FirefoxDriver(); | |
driver.get("http://localhost"); | |
WebElement elem = driver.findElement(By.id("divHidden")); | |
System.out.println("And the text is:"); | |
String text = (String)((JavascriptExecutor)driver).executeScript("return arguments[0].innerHTML;", elem); | |
System.out.println(text); | |
} | |
} |
This file contains 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
<body> | |
<div id="divDisplayNone" style="display: none;">Text inside display:none</div> | |
<div id="divHidden" style="visibility: hidden">Text inside visibility:hidden</div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment