Page 1 of 1

How to click a button via CEF4Delphi without javascript

Posted: Sun Feb 26, 2023 11:06 pm
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.

Re: How to click a button via CEF4Delphi without javascript

Posted: Mon Feb 27, 2023 2:30 pm
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.