Fetch a node's tag name

This commit is contained in:
Jason Morrison 2011-02-26 14:55:40 -05:00
parent 2a7d49d503
commit ba3f0b1a18
3 changed files with 9 additions and 2 deletions

View File

@ -33,7 +33,7 @@ class Capybara::Driver::Webkit
end
def tag_name
raise NotImplementedError
invoke "tagName"
end
def visible?

View File

@ -125,5 +125,8 @@ describe Capybara::Driver::Webkit do
expect { subject.execute_script(%<invalid salad>) }.
to raise_error(Capybara::Driver::Webkit::WebkitError)
end
end
it "returns a node's tag name" do
subject.find("//p").first.tag_name.should == "P"
end
end

View File

@ -24,6 +24,10 @@ Capybara = {
attribute: function (index, name) {
return this.nodes[index].getAttribute(name);
},
tagName: function(index) {
return this.nodes[index].tagName;
}
};