My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 3218: InternetExplorerDriver.getPageSource() returns empty string
1 person starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  ----
Closed:  Jan 2012


Sign in to add a comment
 
Reported by rodrigol...@gmail.com, Jan 17, 2012
Hi all,

I'm testing Selenium for using into a project. I'm trying to create a very simple test to be run as JUnit test case. The test loads google main page and try to write something in the textbox. This is my code:

public class SeleniumTest
{
	private WebDriver driver;
	
	@Before
	public void SetUp()
	{
		//driver = new FirefoxDriver();
		driver = new InternetExplorerDriver();
		//driver = new HtmlUnitDriver();
		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
	}
	
	@Test
	public synchronized void Test()
	{
		driver.get("http://www.google.com");
		
		System.out.println("PageSource: " + driver.getPageSource());
		
		driver.findElement(By.xpath("//div/input")).clear();
		driver.findElement(By.xpath("//div/input")).sendKeys("test");
	}
}

When I run the test using FirefoxDriver or HtmlUnitDriver it runs ok, and driver.getPageSource() returns the source of the page. But If I run the test using InternetExplorerDriver, driver.getPageSource() returns an empty string and driver.findElement doesn't find the textbox (I suppose it doesn't loads the page or the page is not loaded yet). Below are the system details and the stack trace that I obtain when I use InternetExplorerDriver. Is anyone else having the same problem? Is something wrong in my configuration? 

Selenium version: 2.17.0
OS: Windows XP
Browser: Internet Explorer
Brower version: 8

Trace: org.openqa.selenium.InvalidSelectorException: The xpath expression '//div/input' cannot be evaluated or does notresult in a WebElement (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 172 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '2.17.0', revision: '15540', time: '2012-01-16 16:52:31'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_26'
Driver info: driver.version: RemoteWebDriver
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:439)
	at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:226)
	at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:299)
	at org.openqa.selenium.By$ByXPath.findElement(By.java:344)
	at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:218)
	at com.csc.test.SeleniumTest.Test(SeleniumTest.java:57)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


Thanks in advance.



Jan 18, 2012
#1 rodrigol...@gmail.com
I repeat the same test on a fresh install of Windows XP and it works OK! It should be produced by a Internet Explorer security policy of my company.
Jan 18, 2012
Project Member #2 dawagner@gmail.com
(No comment was entered for this change.)
Status: Invalid
Sign in to add a comment

Powered by Google Project Hosting