Skip to main content

Posts

Showing posts with the label addExtension

Installing and Uninstalling Add-ons in Firefox Browser

Almost a month back, we discussed how we can install an extension in Selenium 3: https://www.linkedin.com/posts/dheerajgambhir_seleniumautomation-chromeext-automationtesting-activity-6587948591678095361-Lr7m Or https://testersdigest.blogspot.com/2019/10/need-extension-while-running-your-se.html And now in Selenium 4, we have direct method installExtension and uninstallExtension for the firefox Driver. The installExtension installs a new addon with the current session which inturn will return an ID that may later be used to uninstallExtension the addon using uninstallAddon.

Need extension while running your SE scripts?

Though I am not able to find a good use case when we'll need an extension while running our automation Se scripts but in case, you need an extension while running your SE scripts, here's how you can do it: Step 1) Download Your Chrome Extension. To do this, get your webstore URL from the Google Web Store like " https://chrome.google.com/webstore/detail/page-load-time/fploionmjgeclbkemipmkogoaohcdbig?hl=en "  Step 2) Then go to http://crxextractor.com/ and enter the Chrome web store URL that you get from Step 1 in the URL field to download the .crx file of the required extension. Step 3) Once you have the .crx file of that extension, it's time to save it somewhere so that you can use it in your SE script. Step 4) Use addExtensions method of ChromeOptions class in your SE script. Sample code: public class WithExt {   static WebDriver driver;  @Test  public static void chromeWithExtensions() throws InterruptedException {