Skip to content

Commit

Permalink
fix: update the selectors broken by website update
Browse files Browse the repository at this point in the history
  • Loading branch information
onur-yildiz committed May 5, 2022
1 parent ea006dc commit 37e5361
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Puppeteer/Puppet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static async Task Login(Page page)
await page.GoToAsync("https://www.myinstants.com/accounts/login/?next=/new/");
await page.TypeAsync("input[name=login]", creds[0]);
await page.TypeAsync("input[name=password]", creds[1]);
await page.ClickAsync("div.input-field>button[type=submit]");
await page.ClickAsync("button[type=submit]");

//await page.WaitForNavigationAsync();
await page.WaitForSelectorAsync("#id_name");
Expand All @@ -65,12 +65,13 @@ static async Task Upload(Page page, string name)
Console.WriteLine("Uploading audio...");
await page.TypeAsync("#id_name", name + Guid.NewGuid().ToString());
var fileChooserDialogTask = page.WaitForFileChooserAsync();
var termsCheckbox = await page.WaitForSelectorAsync("input[type=checkbox]");
await Task.WhenAll(fileChooserDialogTask, page.ClickAsync("input[name=sound]"));
var fileChooser = await fileChooserDialogTask;
await fileChooser.AcceptAsync("./media/output.mp3");
var termsCheckbox = await page.WaitForSelectorAsync("input[type=checkbox]");
await page.EvaluateFunctionAsync("cb => cb.click()", termsCheckbox);
await page.ClickAsync("input[type=submit]");
await page.FocusAsync("button[type=submit]");
await page.Keyboard.PressAsync("Enter");

//await page.WaitForNavigationAsync();
await page.WaitForSelectorAsync("a.instant-link");
Expand Down

0 comments on commit 37e5361

Please sign in to comment.