Home > Software engineering >  Use CHtmlView automated tests found that need to use the mouse to click activate to submit the form
Use CHtmlView automated tests found that need to use the mouse to click activate to submit the form

Time:11-16

Do automated testing, and most recently used CHtmlView, found A problem, there is A input box and an A B button, input box can set number, B B has been the focus and the blur and the input box, and then click A button can response, but run not bottom go to, will quote exception Js: : JavascriptExceptionObject, this is A button type & lt; Input type="submit" & gt; , but if you use the mouse to click before you click this button to A web page margins, the form can be submitted to complete the process right,
But if you don't use the mouse to click the CHtmlView, can't correct the enter key to submit

PS: I tried mouse_event was used to simulate the mouse to click, too, a mystery,

Thank you ~

CodePudding user response:

CHtmlView filling forms and simulate the click event

CodePudding user response:

Thank moderator reply, these all did, even with all kinds of simulation methods are not line, want to use the mouse to click the first CHtmlView web space, have the effect,

CodePudding user response:

You call the COM interface to operate elements, does not trigger the corresponding event, such as you to call the submit will not trigger the onsubmit, you to change the check box or radio button option will not start onchange

Operation, the more you trigger involves all the corresponding event is not feasible, many operations will trigger multiple events at the same time, for example, if you change the focus will trigger an element of an onfocus, onblur another element, as well as the corresponding onfocusin and onfocusout, relatively simple solution is to look at a script exception is where a line before and then on the way up to see what event to trigger,

Triggering event can use IHTMLElement3: : FireEvent, before use IHTMLDocument4: : CreateEventObject create events, events that created a lot of attribute value is empty, the script if access to the window. What attributes of the event (such as MouseEvent. Button or MouseEvent. X/y), if you want to manually set the,

If your browser controls is Internet explorer 9 model in IDocumentEvent/IDOMEvent and IEventTarget the API, IE11 there some event types, such as onclick instead MouseEvent parameter MSPointerEvent, if your browser compatibility mode and control site looking forward to, also may be abnormal,

Some websites have the robot, this is more trouble, each site is different and often change,
  • Related