How to click a javascript button

I would like to be able to click this. I am coding in C # and I am using the built in firefox cefsharp. I came across the code below and I would like to click it if I can. For reference: Definition of ExecuteScriptAsync.

public void ExecuteScriptAsync(string script);

      

This allows me to write javascript. Combined with a browser after visiting a web page. For example, it allows me to fill out an email form and a password form and click "Login".

browser.ExecuteScriptAsync("document.getElementById('Email').value=" + '\'' + txtEmail.Text + '\'');   
browser.ExecuteScriptAsync("document.getElementById('Passwd').value=" + '\'' + txtPassword.Text + '\'');     
browser.ExecuteScriptAsync("document.getElementById('signIn').click()");

      

Below is what I would like to click if possible.

<button class="KjTtD twEJfe uq" title="Call a phone">

    <div class="rYvKwe"></div>

</button>

      

As long as I can click the mouse. To get the above code, I used the Firefox firefox checker element. I've tried several different ways to click it.

As below.

browser.ExecuteScriptAsync("$('#button a:eq(1)').click();");

      

and

browser.ExecuteScriptAsync("document.getElementByTitle('Call a phone').click()");

      

Is it even possible to click on it? If so, can someone point me in the right direction? Thank!

+3


source to share





All Articles