How to disable Reader View in Firefox using webdriver

3.1k views Asked by At

Whenever I run my test in firefox, 'Reader View' message box pops up in the address bar. This pop up hides the element from view, so Webdriver is throwing "ElementnotvisibleException. This pop up is displayed for the pages in languages other than English. I disabled the reader view option. This does not help me much.Any thoughts on how to overcome this issue will be much appreciated.

Thanks

4

There are 4 answers

3
Ivan Litskevich On
  1. Navigate to about: config
  2. To remove Reader view, change reader.parse-on-load.enabled preference value to ‘false‘.

Or just downgrade your Firefox. Mozilla enabled Reader view feature in Firefox 38.0.5

0
ganeshnarayanan On

It is simple thing you can tackle this kind of inconvenience. Just use refresh code for this script.

For Example: driver.navigate().refresh();

0
DK1967 On

I just encountered this same issue. The initial load of a Firefox browser showed the Reader View alert and the test couldn't see the page elements behind the alert. Although I turned off the Reader View on the Firefox about:config page, the raw FF browser that my test starts does not regard that setting.

My solution was simply to program a reload of the page. The subsequent page load doesn't show the Reader View alert and things work as I intended.

A bonus to this simple solution is that it will work for whomever runs the test - you won't need to require a Firefox admin tweak for all who run the test.

1
Antonio Terreno On

Something like this:

@Before
public void setUp() throws Exception {
    FirefoxProfile firefoxProfile = new FirefoxProfile();
    firefoxProfile.setPreference("reader.parse-on-load.enabled",false);
    driver = new FirefoxDriver(firefoxProfile);
    baseUrl = "http://google.com";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

should do it.