ulixee / hero

The web browser built for scraping
MIT License
696 stars 33 forks source link

Handle Permission Prompts (edited title) #159

Open Baker68 opened 2 years ago

Baker68 commented 2 years ago

When this modal appears the script execution is stopped, it does not execute your next action. I've encountered this issues on Amazon & Google. Is there a way to detect and interact with permission, to click on Block or Allow ?

blakebyrnes commented 2 years ago

We might need to add that in. Can you not use the waitForDialog to see those?

Baker68 commented 2 years ago

@blakebyrnes , I can't find the waitForDialog method. However I did managed to "skip" this issue by using the geolocation param :

const browser = new Agent({
      showReplay: false,
      humanEmulatorId: 'basic',
      geolocation: { latitude: 10, longitude: 10 },
    });

So if anyone encountered this issue before, this is the way to go, at least for now.

blakebyrnes commented 2 years ago

@Baker68, sorry, I meant tab.on('dialog') and then dismissing when it comes up. I didn't check if it gets triggered or not. We likely need to add something. Thanks for the workaround in the interim!

blakebyrnes commented 2 years ago

Enhancement here is to enable a way to either specific "deny" for geolocation, or specify broader permissions on Agent boot up.