Since the Pinterest API is down, I am trying to write a CEFSharp app. to login and pin to my boards manually. Here is the Pinterest form html.
<form data-test-id="registerForm" method="POST" novalidate=""><div data-test-id="emailInputField" class="zI7 iyn Hsu"><fieldset style="position: relative; margin-bottom: 7px;"><span><input aria-invalid="false" autocomplete="username" class="wyq Hsu tBJ dyH iFc yTZ L4E unP iyn Pve pBj qJc aKM xD4" id="email" name="id" placeholder="Email" type="email" value=""></span></fieldset></div><div data-test-id="passwordInputField" class="zI7 iyn Hsu"><fieldset style="position: relative;"><span><input aria-invalid="false" autocomplete="new-password" class="wyq Hsu tBJ dyH iFc yTZ L4E unP iyn Pve pBj qJc aKM xD4" id="password" name="password" placeholder="Password" type="password" value=""></span></fieldset></div><div style="float: left; margin-bottom: 12px; margin-top: 8px;"><a href="/password/reset/" style="color: rgb(51, 51, 51); font-size: 14px; font-weight: bold;">Forgot your password?</a></div><div id="recaptcha_placeholder_1" class="g-recaptcha" style="margin-top: 16px; transform: scale(0.88); transform-origin: 0px 0px 0px;"></div><div data-test-id="registerFormSubmitButton"><button aria-label="" class="red SignupButton active" type="submit" style="border: 0px; height: 36px; display: inline-block; border-radius: 20px; -webkit-font-smoothing: antialiased; padding: 0px 18px; font-size: 15px; font-weight: bold; outline: none; box-shadow: none; cursor: pointer; margin-top: 10px; vertical-align: middle; text-align: center; background-color: rgb(230, 0, 35); color: rgb(255, 255, 255); width: 100%;"><div>Log in</div></button></div></form>
I put the code below in the JQuery section of JFiddle to test the code and it sets the 2 inputs. So I'm stumped why CEFSharp can't set those imputs. I'm also in need of how to write the code to click the Submit button but one step at a time.
Given the form html above running these 2 lines of code below in the test app called JFiddle sets the 2 input fields successfully.
$('input[name=id]').val('john@mydomain.com');
$('input[name=password]').val('pinterestpassword');
Doing the same thing using a CefSharp App, fails to set the 2 input fieds.
chromeBrowser = new ChromiumWebBrowser("https://www.pinterest.com/login");
chromeBrowser.LoadingStateChanged += chromeBrowser_LoadingStateChanged;
private void chromeBrowser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs la)
{
if(la.IsLoading == false)
{
// does not set the 2 input fields
chromeBrowser.ExecuteScriptAsync("$('input[name=id]').val('john@mydomain.com')");
chromeBrowser.ExecuteScriptAsync("$('input[name=password]').val('pinterestpassword')");
// tried the code below also but it doesn't work either
//chromeBrowser.ExecuteScriptAsync("$('input[name=id]').val(\"john@mydomain.com\")");
//chromeBrowser.ExecuteScriptAsync("$('input[name=password]').val(\"pinterestpassword\")");
}
}