Skip to content

Vijay-Nirmal/StackOverFlow-LogIn

Repository files navigation

StackOverFlow LogIn

Sample app to LogIn to StackOverFlow

Here is an example for Entering text in search box and Click search button in Bing

  1. Use WebView to do all the work

    WebView webView = new WebView();
    
  2. Use InvokeScriptAsync method for WebView to use JS code

    webView.InvokeScriptAsync("eval", new string[] {});
    
  3. Get the HTML of the site using below code

    private async void GetHTMLAsync()
    {
        var siteHtML = await webView.InvokeScriptAsync("eval", new string[] { "document.documentElement.outerHTML;" });
    }
    
  4. Enter text in search box using below code

    private async void EnterTextAsync(string enterText)
    {
        var functionString = string.Format(@"document.getElementsByClassName('b_searchbox')[0].innerText = '{0}';", enterText);
        await webView.InvokeScriptAsync("eval", new string[] { functionString });
    }
    
  5. Simulate click using below code

    private async void SimulateClickAsync()
    {
        var functionString = string.Format(@"ddocument.getElementsByClassName('b_searchboxSubmit')[0].click();");
        await webView.InvokeScriptAsync("eval", new string[] { functionString });
    }
    
  6. Get new site's HTML using Step 3

About

Sample app to LogIn to StackOverFlow

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages