New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can I autofill input fields by code? #828
Comments
Who ya' gonna call? http://youtu.be/m9We2XsVZfc 👻 No no no ... Call JS: https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#CallJS |
wow! lets see!! |
@pipiscrew Happy to close this one? |
sorry for the delay, I done something like //the browser
private readonly WebView web_view;
public Form1()
{
InitializeComponent();
web_view = new WebView("http://y.com/", new BrowserSettings());
}
private void button1_Click(object sender, EventArgs e)
{
web_view.ExecuteScript("document.getElementById('email').value=" + '\'' + "takis" + '\'');
web_view.ExecuteScript("alert('test');");
} worked! thanks for the quick responses. |
Excellent - thanks for sharing 👍 (and following up with closing) Marking as ``faq-able!` |
@pipiscrew Out of curiosity are you still using |
@amaitland , I downloaded the CefSharp-v1.25.8-binaries from releases and using the lib, what are you mean by CefSharp1 ? the dlls built on 12/2/2015.. user_agent = Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22 wow, https://github.com/cefsharp/CefSharp/releases the latest is I downloaded the first one, seems incorrect.. is not the latest :( please advise + whats new(?) |
The official release is We don't release binary versions in zip form anymore, they're all released as |
I'd personally be using at a minimum version |
what new (?) beside chromium updates, please. thanks for warning |
Too many things to list individually. Feel free to look at the changelog. |
(The fact that we no longer support |
oh my god :) I have to do a remake of the app :) thanks for update me...! check the freewares at http://bit.ly/1FT21o9 |
In my experience it usually takes about 5-15mins to upgrade, a few things have changed, like
Is that a link to your app? |
with v39pre2 dlls, I replace WebView with ChromiumWebBrowser as you mention above public Form1()
{
InitializeComponent();
web_view = new ChromiumWebBrowser("http://x.com/api/");
web_view.LoadCompleted += new LoadCompletedEventHandler(web_view_LoadCompleted);
web_view.Dock = DockStyle.Fill;
panel1.Controls.Add(web_view);
}
//url watcher for autofill
void web_view_LoadCompleted(object sender, LoadCompletedEventArgs url)
{
if (url.Url.ToLower().StartsWith("https://www.x.com/login.php?skip_api_login"))
{
web_view.ExecuteScriptAsync("document.getElementById('email').value=" + '\'' + General.login_name + '\'');
web_view.ExecuteScriptAsync("document.getElementById('pass').value=" + '\'' + General.login_password + '\'');
web_view.ExecuteScriptAsync("document.getElementById('login_form').submit();");
}
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
CEF.VisitAllCookies(d);
} *referenced dlls : * |
Use |
If the browser doesn't appear on the form when you run it, try going through these troubleshooting steps (particularly point 4): https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting You should see a process called |
So, finally all functions working as constructed for v1.25.8... ps - CefSharp3 is a monster!! thanks |
@pipiscrew What did the problem turn out to be in the end? Anything you can share with future CefSharp 1 -> 3 upgraders like yourself? |
as described above^ except turn type : WebView to ChromiumWebBrowser before instantiate ChromiumWebBrowser must initialize Cef *CefSharp snippets : * thanks! |
what if your login form is like this below, what do i use then?
|
last time I used was at 2015, dont know for newer version, as written above use Javascript code and execute it with Webview as (in the following example set the word takis to element has name="email") :
see the 2nd reply for details |
the answer for my previous question:
|
This code worked for me too as shown above...
But how did youI execute the submit button code below? |
if you form has id = login_form
more samples @ https://bit.ly/2vBOEZm |
I tried using the following, it didn't throw any errors but when I load the page, it doesn't plug the values into any of the fields...
I make sure to include P.S. I'm pretty new and still learning... |
but with CEF is possible use also Jquery for select elements ? |
@chipotlejess, as @totti240282 says. Use vanilla JS :
|
But how can i input the value onto the ID using CefSharp on VB .NET |
see this |
okay that looks pro level, so i found this code snippet:
I can't get this to work because of the variables. How do I add VB.NET variables to a javascript code (the one above). Variable1 is string value which the user inputs in a TextBox and variable 2 is a constant string value. |
Got this working out? Just curious. |
|
Please ask questions on https://github.com/cefsharp/CefSharp/discussions |
in IE
in CefSharp (?)
thanks
The text was updated successfully, but these errors were encountered: