Skip to content
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

Failed to add account due to the logout button was changed and failed to logout #39

Open
mystasly48 opened this issue Oct 4, 2020 · 0 comments
Labels
Bug Report a bug or unexpected behaviors (for developers and users)

Comments

@mystasly48
Copy link
Owner

Currently, the program will logout after logged in.
The code that the bug is caused is

if (webBrowser1.Url.OriginalString == AuthUrl1 || webBrowser1.Url.OriginalString == AuthUrl2) {
  var r = new Regex(@"<CODE>(\d+)</CODE>");
  var m = r.Match(webBrowser1.DocumentText);
  if (m != null) {
    PIN = m.Result("${1}");
    Success = true;
  }
  authorizingLabel.Visible = true;
  webBrowser1.Visible = false;
  webBrowser1.Navigate(LogoutUrl);
} else if (webBrowser1.Url.OriginalString == LogoutUrl) {
  // logout
  var logout = webBrowser1.Document.GetElementsByTagName("button").OfType<HtmlElement>()
  .Where(x => x.OuterHtml.Contains("js-logout-button")).FirstOrDefault();
  logout.InvokeMember("click");
.....

Specifically,

  webBrowser1.Navigate(LogoutUrl);
} else if (webBrowser1.Url.OriginalString == LogoutUrl) {
  // logout
  var logout = webBrowser1.Document.GetElementsByTagName("button").OfType<HtmlElement>()
  .Where(x => x.OuterHtml.Contains("js-logout-button")).FirstOrDefault();
  logout.InvokeMember("click");

The button's class names were changed and logout.InvokeMember('click") is failed.

We can fix the bug by changing the name to specify the button actually.
But Twitter may change the name again in the future, and the bug will be happened again.
We need to find out a solution that can be used permanently.

@mystasly48 mystasly48 added the Bug Report a bug or unexpected behaviors (for developers and users) label Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report a bug or unexpected behaviors (for developers and users)
Projects
None yet
Development

No branches or pull requests

1 participant