Vasseurth
Vasseurth

Reputation: 6486

Watir select option not in list

I'm using watir to test/run through my site.

I'm wondering if it is possible to use watir to set the value of a select list that is not on the options list. I've noticed that with Ruby Mechanize you can simply set the value of the field, but it is not quite the same with Watir.

Additional details (extracted from comments):

There is a select for the page size (i.e. how many items to show per page) named pageSize. The options are 5, 10, 20, and 30. However, for testing purposes I'd like to display more than that (e.g. 100). I'm using browser.select_list(:name, "pageSize").select "30" to select the 30. But browser.select_list(:name, "pageSize").select "100" wouldn't work since there is not option with the value 100.

How might I get the page to return 100 values per page?

Thanks!

Upvotes: 0

Views: 272

Answers (1)

titusfortner
titusfortner

Reputation: 4194

Watir is designed to do the things that a user can do on a page for testing purposes. That being said, many of those select list size dropdowns are updating the url, often resulting in a page like: http://example.com/sprockets?per_page=10

If that is the case, then you might be able to scrape and then change the value in the url to see what you want.

Upvotes: 3

Related Questions