Home > Net >  Now want to pass the.net web automation operation, but when a download prompt, mouse clicks doesn�
Now want to pass the.net web automation operation, but when a download prompt, mouse clicks doesn�

Time:10-01

As title, webbrower loading web pages is in control, the mouse is moved to the "save", and is unable to click on, I don't know what's the problem?

CodePudding user response:

111 code?

CodePudding user response:

 


Cursor. The Position=New Point (251, 1054) 'mouse

Mouse_event (& amp; H2, 0, 0, 0, 0) 'mouse the left key press
Mouse_event (& amp; H4, 0, 0, 0, 0) 'the left mouse button to release

251, 1054 is the "Save" coordinates

CodePudding user response:

See if the antivirus software prevents

CodePudding user response:

I think is the focus of the problem, because I used this method to simulate click desktop icon is no problem, it is this webbrower controls within the pop-up window can't click,

CodePudding user response:

The simulated return useful?

CodePudding user response:

Simulate the enter also useless, but if time click on the keyboard or click the mouse can be used, I also tried to use soft keyboard, click the soft keyboard is not,

CodePudding user response:

 
Web. WebBrowser1. Document. GetElementById (" Subject "). The InnerText="company name" 'input company name used in theme for the screening of
Web. WebBrowser1. Document. GetElementById (" btnSearch "). InvokeMember (" click ") 'click Search

Web. WebBrowser1. Document. GetElementById (" btnExport "). InvokeMember (" click ") 'click Export

Cursor Position=New Point (1031, 553) 'the mouse but realize

Mouse_event (& amp; H2, 0, 0, 0, 0) 'mouse the left key press cannot achieve
Mouse_event (& amp; H4, 0, 0, 0, 0) 'the left mouse button to release

SendKeys. Send (" {Enter} ") Enter 'simulation, unable to realize

CodePudding user response:

Are you sure this is the active window?

CodePudding user response:

The Public Function SendMessage (ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
End the Function
Public Const WM_KEYDOWN As Integer=& amp; H100
Public Const WM_KeyUP As Integer=& amp; H101
Public Sub SendMouseClick (ByVal handle As IntPtr, ByVal x As an Integer, ByVal y As an Integer)
If the handle & lt;> IntPtr. Zero Then
Dim lParam As IntPtr=New IntPtr ((y & lt; <16) Or x)
Dim wParam As IntPtr=IntPtr. Zero
SendMessage (handle, WM_LBUTTONDOWN wParam, lParam)
Threading. Thread.sleep (100)
My application.doevents ()
SendMessage (handle, WM_LBUTTONUP wParam, lParam)
End the If
End Sub

X, y is the window handle corresponding coordinate system,

CodePudding user response:

Public Const WM_LBUTTONDOWN As Integer=& amp; H201
Public Const WM_LBUTTONUP As Integer=& amp; H202

CodePudding user response:

You found the handle to the window, and then the top, click cancel again after before
  • Related