Janak
Janak

Reputation: 5085

How to find an element by name using Nokogiri?

<input type="Checkbox" checked="" name="new">

if I have the above html in a document, how would I find it by searching for its name attribute?

Edit 1: Clarified that I was looking for a solution using Nokogiri

Upvotes: 2

Views: 1366

Answers (1)

Janak
Janak

Reputation: 5085

$agent.page.at('[@name="new"]')

That should do the trick, where $agent is a variable containing the Mechanize agent

Upvotes: 4

Related Questions