SubmitAsync taking too long (45 seconds)
See original GitHub issueSo, I downloaded this Demo from AngleSharp repository and all did was adding a break inside the foreach
loop because there were some other elements that I didn’t want to fill and I also changed the form to Last
instead of FirstOfDefault
(because the first one is the search bar).
public async Task SubmitForm(IDictionary<String, String> fields)
{
var document = _context.Active;
var form = document.Forms.Last();
var elements = form?.Elements ?? Enumerable.Empty<IHtmlElement>();
int random = 0;
foreach (var element in elements.OfType<IHtmlInputElement>())
{
if (random == 2)
break;
if (fields.TryGetValue(element.Name ?? String.Empty, out string value))
{
element.Value = value;
}
random++;
}
await form.SubmitAsync();
}
`
async void ExecuteSubmit()
{
IsLoading = true;
await _accessor.SubmitForm(new Dictionary<String, String>(StringComparer.Ordinal)
{
["user"] = "Aklim",
["passwrd"] = "azeqsd789456"
});
Update();
var GetWelcomeMessage = _accessor.GetTextOf("div.tborder table:nth-child(2) tbody tr td.titlebg2 span");
MessageBox.Show($"{GetWelcomeMessage}.");
}
This is working fine, it’s just that SubmitAsync is taking too long to execute (45 seconds) and I’m not sure why exactly because if I connect manually, it goes smoothly. I’ve also tried the same code using the WebApp given in the demo, that was almost instant as well.
This is the login link (captcha): https://bitcointalk.org/index.php?action=login;ccode=540745379ff2169d1c1a
If that doesn’t work, you can login using the captcha manually, then visit https://bitcointalk.org/captcha_code.php to get the login link without captcha.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Could you try with the improved HTTP requester from
AngleSharp.Io
@TonyDev314 ?Perfect - fixes the issue.
Many thanks for the swift response - great library by the way!