Couldn't hit a button using selenium-webdriver

**Code:**

    driver.find_element(:name, "btnEdit").submit until
driver.title.include? "View List"

I tried above ".click" also.

It seems nothing is being searched.

Follow the IRB below:

···

=====================================================
D:\Rubyscript\My ruby learning days>answerlist.rb

D:\Rubyscript\My ruby learning days>

the script stopped when the page comes and without throwing an error
returns to the "D:\Rubyscript\My ruby learning days>".

***HTML***

    <td class="dk2564">
    <input type="submit" name="btnEdit" value="Edit Items"
class="btnSmall">
    <input type="hidden" name="_synchToken_btnEdit" value="xxxbgfh"/>
    <input type="hidden" name="_singleSubmit_btnEdit" value="cxdtrys"/>
    </td>

Driver couldn't hit the button `Edit items`. When the page is arrived,no
action is being performed by the above code.

--
Posted via http://www.ruby-forum.com/.

That's not IRB, that's the command console.

One easy way to find out what's going on is to use a webdriver browser
session created in IRB to navigate to the page, and find out what
response you get when you manually enter variations on the command.
without some output it's going to be difficult to trace the issue.

Maybe these would help to give you some ideas:
puts driver.find_elements(:name, "btnEdit").length
puts driver.find_elements(:class, "dk2564").length

Selenium-Webdriver is a bit awkward to use without Watir's API so I
haven't played with it much. Still, the steps to finding the solution
are the same: Experiment using IRB, add debugging helpers around the
problem area by reporting back each line's result, and validate every
interaction before continuing to the next step.

···

--
Posted via http://www.ruby-forum.com/.

I'd say your page title already includes "View List", so it isn't
triggering the command.

···

--
Posted via http://www.ruby-forum.com/.

webdriver should wait for the page to load when it clicks on an element
which causes a redirect or change.
If the change is something which isn't covered by webdriver's normal
approach to waiting, then wait for that specific change to occur using
webdriver's "wait" method.

···

--
Posted via http://www.ruby-forum.com/.

Joel Pearson wrote in post #1095015:

That's not IRB, that's the command console.

One easy way to find out what's going on is to use a webdriver browser
session created in IRB to navigate to the page, and find out what
response you get when you manually enter variations on the command.
without some output it's going to be difficult to trace the issue.

I write "xpath" as below:

p driver.title
driver.find_element(:xpath,"//form[contains(@name,'picklist_PickListItemListForm')]/table[contains(@class,'contentBody')]/tbody/tr/td/table[contains(@class,'content')]/tbody/tr/td/table[1]/tbody/tr/td[contains(@class,'dk64')]/input[contains(@name,'btnEdit')]").click
until driver.title.include? "View List"

Output:

···

=======

D:\Rubyscript\My ruby learning days>answerlist.rb
"View List"

D:\Rubyscript\My ruby learning days>

But the event is not occurring means not happening the click. And If i
removed the "until",then worked fine with "xpath". So what's wrong with
my click? any idea...

--
Posted via http://www.ruby-forum.com/\.

Joel Pearson wrote in post #1095018:

Do you know what "until" does?
Of course the click isn't triggering, you're telling it not to.

Then how to wait till the page load,disallowing the `click` to happen?

···

--
Posted via http://www.ruby-forum.com/\.