Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Go to link document and Web related queries
Capabilities vs Options:
1. Capabilities:
Capabilities are a broad configuration for the WebDriver itself, not just the browser. They define properties of the WebDriver session, which can include browser options, platform details, and browser versions. They are used to communicate overall settings for the WebDriver session, not just for Chrome but across various browsers (e.g., Firefox, Safari).
Node Example:
Dataset example: Add a row, where right is a dictionary
capabilities | shared capability | {"goog:loggingPrefs": {"performance": "ALL"}}2. Options:
Arguments are command-line flags passed directly to the Chrome binary to modify the browser’s behavior, such as running it in headless mode, disabling extensions, or setting window size. They affect how Chrome behaves during the session and are specific to Chrome (not other browsers).
Node Example:
Dataset example: Add a row, where right is a dictionary
add_experimental_option | chromium option | {"mobileEmulation": {"deviceName": "Pixel 2 XL"}}Functions:
So, as of now, Node works with following functions
Dataset:
1. Shared capabilities: This will be applied to ANY browser you select. Provide as a dictionary
capabilities | shared capability | {"unhandledPromptBehavior": "ignore"}2. Page Load Strategy: All browser has this option, however we add this only to the browser mentioned in the mid column. Provide as a string
page_load_strategy | safari option | eager3. Add Argument: All browser has this option, however we add this only to the browser mentioned in the mid column. Provide as list of strings.
add_argument | chromium option | ['--ignore-ssl-errors', '--my-custom-flag']4. Add Experimental Option: Chromium (chrome + edge) has this option, we add this only to the browser mentioned in the mid column. Provide as a dictionary.
add_experimental_option | chromium option | {"mobileEmulation": {"deviceName": "Pixel 2 XL"}}5. Add Extension: Chromium (chrome + edge) has this option, we add this only to the browser mentioned in the mid column. Provide as a list of strings.
add_extension | chromium option | ['path/to/crx_file']6. Add Encoded Extension: Chromium (chrome + edge) has this option, we add this only to the browser mentioned in the mid column. Provide as a list of strings.
add_extension | chromium option | ['extension_in_base64_string']Note: At mid column you can mention,
shared capability(applied to all browser)chromium option(chrome+edge),chrome option,edge option,firefox option,safari option. If you need any option that is not mentioned above, pls contact us.Example:
This Example shows how to add different arguments for different browsers
Queries:
1. How to manage profile?
Ans: You need to find or generate a chrome profile folder. Then add the profile as a folder
add_argument | chromium option | ['--user-data-dir=path/to/profile/folder']As of now, No support for Firefox/Safari browser profile
Find Chrome profile path here,
Find the Profile Path:
Chrome profiles are typically stored in:
2. How to add chrome extension (crx/unpacked_folder/encoded_extension)?
Ans: Extensions can be in 3 forms.
add_extension | chromium option | ['path/to/crx']For adding .crx extension fileadd_argument | chromium option | ['load-extension=ext_dir1,ext_dir2']For adding extension as folder (unpacked)add_encoded_extension | chromium option | ['string1', 'string2']For adding extension as encoded_stringAs of now, No support for Firefox/Safari browser extension
3. How to test on mobile browsers?
Ans: Mobile browser can be selected from run or debug page. When android browser is selected we add and experimental_option
{"mobileEmulation": {"deviceName": "Pixel 2 XL"}}4. Why and when to use go-to-link v2?
Ans: This action was designed to work as a plain selenium script with no complexity. Hence it does not have diversed capabilities like v1. When go-to-link-v1 has issues, v2 is used to investigate the issue.
5. How to connect to remote server, what is debuggerAddress?
Ans:
google-chrome --remote-debugging-port=9222. Expose 9222 port from your VM configdebugger_address | chrome option | "your-vm-public-ip:9222"and remove default experimental_optionsadd_experimental_option | chromium option | {}6. How to handle popups (alert, corfirm, prompt)?
Ans: These are js generated popups and can be handled by selenium. We have alert handle action for that purpose. Additionally, you can set a fixed behavior for all the prompts with a capability in Node
capabilities | shared capability | {"unhandledPromptBehavior": "dismiss/accept/ignore/alert"}7. How to handle non-js browser prompts?
Ans: These are browser generated prompt and not from frontend js script. Selenium does not have the ability to modify them when they appear on the screen. You need to specify the values while launching browser. Browser prompts are mostly of 2 types:
add_experimental_option | chromium option | {"prefs": {"profile.default_content_setting_values.notifications": 2, "profile.default_content_setting_values.geolocation": 1}}Here, 1 = allow, 2 = Blockadd_argument | chromium option | ["--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream"]to bypass UI permission prompt and simulate a fake media device (fake camera or microphone) for testing purposes.https://username:password@www.example.com8. How to add proxy?
Ans: Launch the proxy server and expose the port
add_argument | chrome option | ["--proxy-server=proxy-server-ip:port"]set_preference | firefox option | {"network.proxy.type": 1, "network.proxy.http": "ip", "network.proxy.http_port": "port"}Default arguments used by zeuz
All browsers
"capabilities": {}Chrome & Edge
{ "add_argument": [ "--ignore-certificate-errors", "--ignore-ssl-errors", "--zeuz_pid_finder", ], "add_experimental_option": { "prefs": { "download.default_directory": "download_dir", "download.prompt_for_download": false, } }, "add_extension": [], "add_encoded_extension": [], }Firefox
{ "add_argument": [], "set_preference": { "browser.download.folderList": 2, "browser.download.manager.showWhenStarting": false, "browser.download.dir": "download_dir", "browser.helperApps.neverAsk.saveToDisk": "application/pdf;text/plain;application/text;text/xml;application/xml;application/xlsx;application/csv;application/zip", "browser.download.useDownloadDir": true, "browser.download.manager.closeWhenDone": true, "security.mixed_content.block_active_content": false, } }NOTE: What happens when I add my custom flags? The answer is the default values are removed and only the provided values are added as flags. So we do not appened with our default values.
Links: