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

Feature/edge browser implementation #56

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Harris-H
Copy link

Description

Add Microsoft Edge browser automation support to pydoll library.

Changes

  • Add Edge browser class with Edge-specific configurations
  • Add test suite for Edge browser functionality
  • Update browser initialization to expose Edge support

Testing

All tests passing, including Edge-specific test cases.

This PR addresses issue #41 by adding support for Microsoft Edge browser.


class Edge(Browser):
def __init__(
self, options: Options | None = None, connection_port: int = 9222
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set the default port to None and use the Optional type, so the Base class will generate a random port. I modified the Chrome class since it was causing conflicts in multiple instances

Comment on lines +25 to +32
options.add_argument(f'--remote-debugging-port={connection_port}')
options.add_argument('--remote-allow-origins=*')

# Set default user data directory if not already set
if not any('--user-data-dir=' in arg for arg in options.arguments):
user_data_dir = os.path.join(os.path.expanduser('~'), '.edge_automation')
os.makedirs(user_data_dir, exist_ok=True)
options.add_argument(f'--user-data-dir={user_data_dir}')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you call the super() method, these settings will be applied by default, so you don't need to duplicate them here

Comment on lines +17 to +22
options.add_argument('--no-first-run') # Disable first run experience
options.add_argument('--no-default-browser-check') # Disable default browser check
options.add_argument('--disable-crash-reporter') # Disable crash reporting
options.add_argument('--disable-features=TranslateUI') # Disable translation UI
options.add_argument('--disable-component-update') # Disable component updates
options.add_argument('--disable-background-networking') # Disable background networking
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a class to manage the options called BrowserOptionsManager.

Here's my suggestion:

You can create an Enum with the available browsers, pass the browser name to the Browser class, and then forward it to the BrowserOptionsManager. There, you can create a method to configure the specific Edge options and call it if the specified browser is Edge.

Another idea: You can create a specific Options class that inherits from Options and set a property called browser. So, if the user wants to use Edge, they will have to use the specific Edge Options class.

In BrowserManagerOptions, you can check the browser property and then call the specific methods to configure each browser.

What do you think?

If you proceed with this idea, you'll have to create a specific class for Chrome too, inheriting from the base Options class and setting the browser property to "chrome".

@thalissonvs
Copy link
Owner

Hi @Harris-H,

First of all, thanks for your contribution! This feature is amazing.

I just left some comments to maintain the Pydoll code style and ensure the separation of concerns.

@thalissonvs thalissonvs linked an issue Mar 12, 2025 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

[Feature Request] Add Microsoft Edge browser support
2 participants