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

I am not able to capture URLs in Firefox browser #172

Open
raghavnaphade opened this issue Sep 29, 2023 · 3 comments
Open

I am not able to capture URLs in Firefox browser #172

raghavnaphade opened this issue Sep 29, 2023 · 3 comments

Comments

@raghavnaphade
Copy link

No description provided.

@vojtabohm
Copy link

vojtabohm commented Jul 12, 2024

This is because it does not work with the approach this library uses (which is to use AppleScript to 'tell' the browser to return it's url). I solved this a while ago on my macOS project. You can actually use Accessibility API to get it.

  1. You need to set AXManualAccessibility on the Firefox process, which will enable it's DOM to be visible (this property tells the app a 'Screen reader' is present on the screen, so this is a sort of a hack).
  2. Traverse the Firefox's DOM (consisting of AXUIElement) using BFS until you find a node that has a url attribute and read that.

It's a hassle to add this, but unfortunately, no better way to do this for Firefox. I read their forums a while back.

@jntstewart
Copy link

@vojtabohm, hope you are doing well! Have you recently tested if your approach still works? I have tried setting AXManualAccessibility to true on the Firefox process, but get errors both on AppleScript and Swift. Thanks.

@vojtabohm
Copy link

vojtabohm commented Aug 24, 2024

Hey @jntstewart. I haven't tried it in a while but if I remember, even though it returned errors, it still worked.

I found one forum link I checked in the past. They say Firefox actually needs the AXEnhancedUserInterface attribute. But I believe some other people reported this attribute breaks window behavior on some other apps...

Just try it, experiment with these two attributes. I also remember I had a delay of 3 seconds after an app was opened (to wait for it to load) before I toggled these attributes.

Some combination of these things worked for Firefox in the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants