Search This Blog

July 27, 2018

Fixed the Firefox issue in Selenium : out of bounds of viewport width (1600) and height (786)

Today I used Firefox 61 to run some tests and 2 tests failed due to the following error. 

System.InvalidOperationException : (345.816650390625, 789.8833312988281) is out of bounds of viewport width (1600) and height (786) (MoveTargetOutOfBounds) 

2 tests are running fine in Chrome and Microsoft Edge.  

After looking into this issue, it looks like there is the bug in Gecko Driver about the viewpoint width and height of Firefox. In order to let the tests pass, I need to add the code to handle this issue. 

Since the Firefox has the issue related to out of bounds of viewpoint width and height, the quickest way to handle it is to add ScrollDown() method. 

After adding it and running the tests, 2 tests pass without any issue.  

       public void ScrollDown() 
        { 
            ((IJavaScriptExecutor)_driver).ExecuteScript("scroll(0,450);"); 
        } 

1 comment:

M said...

Hi,
where did you add it?