WebBrowser浏览器控件,怎么获取页面某网页元素XPATH
1个回答
2016-04-01 · 知道合伙人互联网行家
关注
展开全部
首先:鼠标API函数
[DllImport("User32")]
public extern static void mouse_event(int dwFlags, int dx, int dy, int dwData, IntPtr dwExtraInfo);
[DllImport("User32")]
public extern static void SetCursorPos(int x, int y);
[DllImport("User32")]
public extern static bool GetCursorPos(out POINT p);
public struct POINT
{
public int X;
public int Y;
}
public enum MouseEventFlags
{
Move = 0x0001,
LeftDown = 0x0002,
LeftUp = 0x0004,
RightDown = 0x0008,
RightUp = 0x0010,
MiddleDown = 0x0020,
MiddleUp = 0x0040,
Wheel = 0x0800,
Absolute = 0x8000
}
其次:载入webBrowser
private void FormBrower_Load(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.csdn.net");
}
接着:根据鼠标API获取到X,Y坐标区域。。
[DllImport("User32")]
public extern static void mouse_event(int dwFlags, int dx, int dy, int dwData, IntPtr dwExtraInfo);
[DllImport("User32")]
public extern static void SetCursorPos(int x, int y);
[DllImport("User32")]
public extern static bool GetCursorPos(out POINT p);
public struct POINT
{
public int X;
public int Y;
}
public enum MouseEventFlags
{
Move = 0x0001,
LeftDown = 0x0002,
LeftUp = 0x0004,
RightDown = 0x0008,
RightUp = 0x0010,
MiddleDown = 0x0020,
MiddleUp = 0x0040,
Wheel = 0x0800,
Absolute = 0x8000
}
其次:载入webBrowser
private void FormBrower_Load(object sender, EventArgs e)
{
webBrowser.Navigate("http://www.csdn.net");
}
接着:根据鼠标API获取到X,Y坐标区域。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询