Hi,
Perhaps that web page has some kind of protection against JavaScript modifications in the client.
Read this :
https://stackoverflow.com/questions/318 ... lient-side
https://stackoverflow.com/questions/205 ... er-console
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Problems with ExecuteJavaScript delphi
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Problems with ExecuteJavaScript delphi
You can try the solution given by qaplok or you can use a browser in OSR mode to log every mouse and keyboard event and later you can send the logged data.Wagner12345 wrote: Mon Dec 03, 2018 2:08 am Is there a possibility that I can simulate the keystrokes of the keyboard in the same way that was used to simulate a click on the Dom?
procedure Simulate_Mouse_Click(X : string; Y : string);
var
MouseEvent : TCefMouseEvent;
KeyEvent : TCefKeyEvent;
begin
MouseEvent.x := strtoint(X)+5;
MouseEvent.y := strtoint(Y)+5;
MiniBrowserFrm.Chromium1.Browser.Host.SendFocusEvent(true);
MiniBrowserFrm.Chromium1.Browser.Host.SendMouseClickEvent(PCefMouseEvent(@MouseEvent), MBT_LEFT, false, 1);
MiniBrowserFrm.Chromium1.Browser.Host.SendMouseClickEvent(PCefMouseEvent(@MouseEvent), MBT_LEFT, true, 1);
end;
Read this :
https://www.briskbard.com/forum/viewtop ... =112&p=372
-
- Posts: 7
- Joined: Thu Jul 26, 2018 5:14 pm
Re: Problems with ExecuteJavaScript delphi
Is there a possibility that I can simulate the keystrokes of the keyboard in the same way that was used to simulate a click on the Dom?
Take a look at my post:
https://www.briskbard.com/forum/viewtopic.php?f=8&t=620
I showed a trick to simulate a click without javascript!
Take a look at my post:
https://www.briskbard.com/forum/viewtopic.php?f=8&t=620
I showed a trick to simulate a click without javascript!
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Problems with ExecuteJavaScript delphi
The "SimpleOSRBrowser" demo has examples for the SendKeyEvent, SendMouseClickEvent, SendMouseMoveEvent and SendMouseWheelEvent procedures but that's a browser in OSR mode.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Problems with ExecuteJavaScript delphi
A few things are done differently in CEF4Delphi but the demos have code examples about many of the most frequently used features.
Open the "DOMVisitor" demo and read the code comments in uDOMVisitor.pas
That demo creates DOM visitors in the GlobalCEFApp_OnProcessMessageReceived procedure and it sends the results using process messages.
Copy all he CEF4Delphi units in the "uses" sections to your application's "uses" sections. You need uCEFProcessMessage to create a TCefProcessMessageRef instance.
Open the "DOMVisitor" demo and read the code comments in uDOMVisitor.pas
That demo creates DOM visitors in the GlobalCEFApp_OnProcessMessageReceived procedure and it sends the results using process messages.
Copy all he CEF4Delphi units in the "uses" sections to your application's "uses" sections. You need uCEFProcessMessage to create a TCefProcessMessageRef instance.
Re: Problems with ExecuteJavaScript delphi
Code: Select all
Chromium1.SendMouseClickEvent(@MouseEvent, MBT_LEFT
evt.buttons equal to 0 and not 1
Re: Problems with ExecuteJavaScript delphi
MouseEvent.modifiers := GetCefMouseModifiers(1);dilfich wrote: Wed Sep 25, 2019 8:30 amWhy the script does not specify a button number?Code: Select all
Chromium1.SendMouseClickEvent(@MouseEvent, MBT_LEFT
evt.buttons equal to 0 and not 1
