Sai
Sai

Reputation: 135

Selenium::WebDriver::Error::ElementNotVisibleError while looping to click button using Watir

I am trying to click a button on loop basis.

Let us say I have following code

if ind == 2
  export_id = @browser.div(:id => pop_id).div(:class => /actionDropDownItem groupChild nonSelectable/,:title => "Export").id
  @browser.div(:id => export_id).click
else
  @browser.div(:id => pop_id).div(:class => /actionDropDownItem groupChild nonSelectable/,:title => "Export").click
end

But it shows error at index value "2" and the Error is

Selenium::WebDriver::Error::ElementNotVisibleError:
Element is not currently visible and so may not be interacted with

Can anyone help me in this case?

Upvotes: 0

Views: 1068

Answers (1)

RK . N
RK . N

Reputation: 308

It would be great if you provide proper html .

Try this once , this would work for you

if ind == 2
  export_id = @browser.div(:id => export_id)
  export_id.click
else
  @browser.div(:id => pop_id).div(:class => /actionDropDownItem groupChild nonSelectable/,:title => "Export").click
end

Upvotes: 1

Related Questions