private void _InstantLogin(object sender, FrameLoadEndEventArgs e) { MainBrowser.ExecuteScriptAsync($@"document.getElementsByClassName(""tv-control-material-input tv-signin-dialog__input tv-control-material-input__control"")[0].setAttribute(""value"", ""{credentials.Read("username")}"");"); MainBrowser.ExecuteScriptAsync($@"document.getElementsByClassName(""tv-control-material-input tv-signin-dialog__input tv-control-material-input__control"")[1].setAttribute(""value"", ""{credentials.Read("password")}"");"); MainBrowser.ExecuteScriptAsync(@"document.getElementsByClassName(""tv-button tv-button--no-border-radius tv-button--size_large tv-button--primary_ghost tv-button--loader"")[0].click();"); MainBrowser.FrameLoadEnd -= _InstantLogin; }
private async Task ClearAds() { if (!blockAdsCheckbox.IsChecked.Value) { return; } MainBrowser.ExecuteScriptAsync(@"document.getElementsByClassName(""closeButton-10VUlhi4- closeButtonAdv-2pjmC0Yh- js-toast__close"")[0].click();"); await Task.Delay(800); MainBrowser.ExecuteScriptAsync(@"document.getElementsByClassName(""js-dialog__action-click js-dialog__no-drag tv-button tv-button--link tv-button--no-padding i-float_left"")[0].click();"); }
private void Login() { this.Dispatcher.Invoke(() => { MainBrowser.Address = "https://uk.tradingview.com/#signin"; MainBrowser.FrameLoadEnd += _InstantLogin; try { MainBrowser.ExecuteScriptAsync(@"document.getElementsByClassName(""tv-dialog__error tv-dialog__error--dark"")[0].click();"); } catch (Exception e) { MessageBox.Show(e.Message); } }); }