0
votes

I have a question about select_list which got populated in run time according to the option of some other select list.

For an example If I choose motor car make in my select_list, then model select_list got populated. but the problem is, I have to wait for few seconds before I interact with model select_list otherwise it throws the error no options present(because it takes some time to populate). I find very interesting thing in WATIR 6.0.2 like

b.link(:id,'NewContactNewGenFromMenu_Link').wait_until(&:visible?).click

which first confirm the element present through implicit wait using when_present, then it waits until element visible, this is amazing change. But Is there anything to check whether select list options got populated? Is any new arrangement?

1
For the link example, I would expect you only need b.link(:id,'NewContactNewGenFromMenu_Link').click. The implicit present check means that Watir waits for the element to exist and be visible.Justin Ko
@JustinKo No, It checks whether element exist or not, it doesn't check whether element is visible or not. I faced the problem of 'Element is not visible'. What I am doing is, I am clicking poped up link 'New contact', this pop up when I click 'New', So the delay to appear few seconds is creating 'element is not visible error'.Gopal

1 Answers

2
votes

It looks like there is no change to the Select#select method in Watir 6.0.2 - ie it does not wait:

browser.select_list.select('changed_text')
#=> Watir::Exception::NoValueFoundException

You can get an implicit wait if you locate/select the option directly:

browser.select_list.option(text: 'changed_text').select

I think the wait functionality should be added to the #select and #select_value methods. I have opened Issue 503 to request the functionality.