0

I have a line of code that links to a button on a HTML page and I'm wondering is there anyway that I can extract a specific value?

<input type="button" style="cursor: pointer;" onclick="selector(item,012345)"<br />

Is there anyway that I can extract the number 012345 from the code above? My current attempt is:

temp = doc.xpath(//div....../input)

but that returns the raw data of the whole button.

4

1 回答 1

3

我无法告诉如何在没有更多上下文的情况下选择正确的输入,但通常你会这样做:

doc.at('input')[:onclick][/\d+/]
于 2012-11-18T02:25:47.813 回答