0

I've come across an issue with some simple javascript when working with IE. This issue has happened on both Windows 7 and 8. At first I had the standard issue which has been well described here and I applied the regex fixes that can be downloaded here but the error simply changed from "Unable to get browser" to

Exception in thread "main" org.openqa.selenium.WebDriverException: JavaScript error (WARNING: The server did not provide any stacktrace information)

So I thought that something might be wrong with the simple piece of Javascript, but all my Javascript seems to run fine in both firefox and chrome but break down on IE.

This is the simple piece of code I used:

WebDriver dr = new InternetExplorerDriver();
dr.get("https://www.bbc.co.uk");
JavascriptExecutor js = (JavascriptExecutor)dr; 
js.executeScript("window.scrollBy(0,150)", "");

Due to the IE Web Driver not providing any stack trace information I have no idea how to actually fix this issue.

And yes my protection levels on IE seem to be in working order. Adding BBC to a list of trusted sites didn't solve the problem either.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Mateusz J
  • 45
  • 7
  • What version of Internet Explorer are you testing on? It could be that the version you're using doesn't [support this method](http://stackoverflow.com/a/9830222/2925985) (see second comment). w3schools suggests I.E. is [supported](http://www.w3schools.com/jsref/met_win_scrollby.asp) (doesn't specify version), but also says that the scrollbar must have its visible property set to true. – Susannah Potts Aug 18 '16 at 14:14
  • Using IE 11.0.96. Is there any way to set that property without breaking how the code works for Chrome/Firefox? I basically want the same thing to ideally work for all three platforms. – Mateusz J Aug 18 '16 at 14:26
  • I'm not sure if it can be set...I know it's located at `window.scrollbars.visible`. You can also check it like [this](http://stackoverflow.com/a/4814526/2925985). Also, what happens if you try the same process but with `scrollTo()`? – Susannah Potts Aug 18 '16 at 14:32
  • So I just ran this command on my IE on that website and I was able to get it to scroll. There might be a problem with your IE settings or the installation all together. – Susannah Potts Aug 18 '16 at 14:36
  • scrollTo returns the same error, which is to say the lack of one due to the lack of stacktrace information. – Mateusz J Aug 18 '16 at 14:37
  • I seem to get the same vague error with any javascript I try to run with IE, not just this example code. I am able to replicate this error on multiple VMs so I'm not sure if its a problem with the web driver or something else. – Mateusz J Aug 18 '16 at 14:43
  • That is bizarre. It might be something with the webdriver then, have you tested directly on I.E. with the console or are you doing it through the webdriver every time? – Susannah Potts Aug 18 '16 at 14:47
  • Are you using IEDriverServer64? The 32x version shoud work fine while the 64x version have some werid bugs even in a 64x OS – Striter Alfa Aug 18 '16 at 15:38
  • Both the 64 and 32 versions cause the same error. I have tested directly on IE and the commands seem to work without any problems. I still have no clue what the problem is. – Mateusz J Aug 19 '16 at 08:35

0 Answers0