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.

How to click a button via CEF4Delphi without javascript

Post Reply
Pcrepair
Posts: 10
Joined: Tue Sep 27, 2022 5:09 pm

How to click a button via CEF4Delphi without javascript

Post by Pcrepair »

Good day salvadordf

there is the html code:

Code: Select all

<form class="form-inline" role="form" method="post" action="">
            <div class="form-group input-group">
              <label class="sr-only" for="email">Email</label>
              <input class="form-control" id="contact" type="text" name="contact" required="">
              <div class="input-group-btn">
                <button class="btn btn-lg btn-danger submit-form" type="submit">send msg</button>
              </div>
            </div>
          </form>
total lack id or name for BUTTON, only CLASS

if it is possible, please point to a way to click on the BUTTON without using javascript, only CEF4Delphi.
Thank you.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to click a button via CEF4Delphi without javascript

Post by salvadordf »

CEF has some limited DOM functions that you can use to find that element.
Then call TCefDomNode.GetElementBounds to get the bounds of the element in device pixels.
Send that information to the main browser process and simulate the mouse movement and mouse click.
See the DOMVisitor and SimpleOSRBrowser demos for all the details.
Post Reply