开发者

InvokeMember with XPath

开发者 https://www.devze.com 2023-03-15 20:38 出处:网络
My purpose is to click a button automat开发者_运维技巧ically in a webBrowser. I am collecting clickables in the source code, and according to these clickables\' xpath values, I want to invoke member c

My purpose is to click a button automat开发者_运维技巧ically in a webBrowser. I am collecting clickables in the source code, and according to these clickables' xpath values, I want to invoke member click.

For invokeMember method, I can use clickable id, but instead, I need to use Xpath. Do you have any ideas?

Here is some code: (I am using c# .NET)

 HtmlElement element = browser.Document.GetElementById(ClickableId);
 element = browser.Document.GetElementById(ClickableId);
 element.InvokeMember("click");

I mean; I want to do this operation with clickable xPath?


From what i've been reading, it is not possible to query a WebBrowser control with XPath.

You might find the following questions useful:

Navigation and WebBrowser control

Get all elements matching an XPath expression in a webbrowser document

0

精彩评论

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