开发者

How to find an element by name using Nokogiri?

开发者 https://www.devze.com 2022-12-25 04:51 出处:网络
<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?
<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: Clarif开发者_Python百科ied that I was looking for a solution using Nokogiri


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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号