简体   繁体   中英

Fluentautomation with multiselect

I am having trouble selecting multiple values from a SELECT box via FluentAutomation.

Sample test case:

I.Open("http://www.htmlcodetutorial.com/forms/_SELECT_MULTIPLE.html");
I.Select(1).From("select[name='toppings']");
I.Select(2).From("select[name='toppings']");
I.Select(3).From("select[name='toppings']");

When this code is executed only the 3rd option is selected, whereas I would like all 3 options to be selected (This would be equivalent to a user holding down ctrl and clicking the 3 options).

This has been tested with Internet Explorer (v11.0.9600.17728) and Chrome (v42.0.2311.90)

Any insights would be appreciated.

Thanks.

I believed what you want is this:

I.Select(1,2,3).From("select[name='toppings']");

See the documentation here:

https://github.com/stirno/FluentAutomation/blob/b084f3e2638edf0a169f4286628706f042dc9339/Docs/v2/actions.select.md

Edit

It appears that there is a bug in the older version of Chrome WebDriver. Because FluentAutomation bundles the Chrome WebDriver in FluentAutomation.SeleniumWebDriver.dll , you must compile this on your computer (instead of using nuget):

  1. Download the latest Chrome WebDriver: https://sites.google.com/a/chromium.org/chromedriver/
  2. Download FluentAutomation source: https://github.com/stirno/FluentAutomation
  3. Go to "{source path}\\FluentAutomation.SeleniumWebDriver\\3rdPartyLib\\" and replace chromedriver.exe with the one downloaded in 1
  4. Recompile FluentAutomation and use the compiled FluentAutomation.SeleniumWebDriver.dll instead of the one you got from nuget.

Good luck!

Edit 2

There is a way to override FluentAutomation's ChromeDriver. See @stirno comments below.

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