Search code examples
domphantomjsui-testingfluentautomation

Issues interacting with elements when using PhantomJS and FluentAutomation.NET


I authored a couple of tests using SpecFlow, PhantomJS, Selenium and FluentAutomation.NET. They run fine on Chrome and FireFox, but when I run them on PhantomJS, they fail.

The error message is:

element is not currently interactable and may not be manipulated

A search shows that this is usually caused by the element either being off screen, the page not being loaded fully or other random failures. Inserting a wait doesn't solve it and setting the .With.WindowSize(1980, 1080) doesn't work either.

The code is very straightforward, almost directly from the samples

I.Focus(SearchInput);
I.Scroll(SearchInput);
I.Enter(searchText).In(SearchInput);

Solution

  • It turns out that setting the WindowWith and ~Height through the Settings object does wonders:

    SeleniumWebDriver.Bootstrap(
        SeleniumWebDriver.Browser.PhantomJs
    );
    
    FluentSettings.Current.WindowHeight = 1080;
    FluentSettings.Current.WindowWidth = 1980;