简体   繁体   中英

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);

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM