0

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.

1 Answers1

0

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.

Chi Chan
  • 11,890
  • 9
  • 34
  • 52
  • Hi Chi. This doesn't work. The selection is triggered individually, as if a user clicks on each operation one after the other. – TriDat Tran Jul 04 '15 at 03:19
  • Hi Tran. This is a WebDriver bug. The bug is resolved in the latest version of the Chrome WebDriver. I have provided you with a workaround for now. I have also opened a ticket on FluentAutomation. See https://github.com/stirno/FluentAutomation/issues/145. Good luck! – Chi Chan Jul 04 '15 at 21:55
  • 1
    Just download the ChromeDriver.exe yourself and add it to your project as Content with Copy Always. If theres an existing ChromeDriver available, Fluent won't unpack the version it has embedded. (We will get the packaged version updated as well, but this is how to override that choice for the future) – stirno Jul 05 '15 at 20:47