click_link with text
This commit is contained in:
parent
233f9fbbd5
commit
5961cac9d6
|
@ -22,7 +22,9 @@ class Webcat::Session
|
|||
end
|
||||
|
||||
def click_link(locator)
|
||||
driver.find("//a[@id='#{locator}']").first.click
|
||||
link = driver.find("//a[@id='#{locator}']").first
|
||||
link ||= driver.find(%{//a[text()="#{locator}"]}).first
|
||||
link.click
|
||||
end
|
||||
|
||||
def body
|
||||
|
|
|
@ -25,6 +25,14 @@ describe Webcat::Session do
|
|||
@session.body.should == 'Another World'
|
||||
end
|
||||
end
|
||||
|
||||
context "with text given" do
|
||||
it "should take user to the linked page" do
|
||||
@session.visit('/with_html')
|
||||
@session.click_link('labore')
|
||||
@session.body.should == '<h1>Bar</h1>'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue