0

I am trying to identify popups where the location bar is not visible in selenium.

JavascriptExecutor js = (JavascriptExecutor) driver; String url = js.executeScript("return window.locationbar.visible;").toString();

The code above works in chrome . Is there a way to do something like this in IE?.I tried running the javascript in console but I do not get "locationbar" option there in IE.

Lance Leonard
  • 3,285
  • 3
  • 16
  • 15
  • Can you elaborate what you mean by identify popups? What are you trying to do with the popups? What worked with Chrome? Show your code. – undetected Selenium Apr 17 '17 at 13:51
  • I want to use window.locationbar.visible to check if the location bar of a window is visible or not.I am using the code above.In chrome it return true when the location bar is visible and false otherwise – Abbas Goher Khan Apr 17 '17 at 14:00

1 Answers1

0

Though the https://msdn.microsoft.com/en-us/library/dn793588(v=vs.85).aspx provides documentation on javascript read-only access to toolbar, a quick research around the internet suggests that IE does not provide access to toolbar and menu-bar.

Open the below link in IE to test http://www.w3resource.com/javascript/client-object-property-method/window-toolbar-example1.html. You will get an alert saying true in other browsers.

enter image description here

See the answer here Internet Explorer 8 JS Error: 'window.toolbar.visible' is null or not an object

Well, the good thing is that Microsoft edge now supports the property (Maybe this is the reason why the toolbar documentation reference is provided in MSDN page).

enter image description here

Community
  • 1
  • 1
StrikerVillain
  • 3,719
  • 2
  • 24
  • 41