I am using chrome_options.add_extension to add the extension into chrome browser and it works fine but the extension is loading in switch off mode. How can i handle that in script.
chrome_options = ChromeOptions()
chrome_options.add_extension(ExtensionPath)
driver = webdriver.Chrome(Chromepath, options=chrome_options)
Related
I'm trying to automate a buying process but I need to have a specific extension active. The extension itself doesn't need to be automated.
Is there a way to activate that extension on Chromium dev mode?
Or is there a way to open my normal Chrome session with all my extensions?
Thanks in advance!
You should be able to do it through a Chromium > 8.0.0. You can specify an args option through the class: Puppeteer, puppeteer.launch().
Condition
Description
--load-extension
Comma-separated list of paths to extensions to load at startup.
let browser = await puppeteer.launch({
//...
ignoreDefaultArgs: [
//...
"--disable-extensions",
args: [
//...
`--load-extension=${PATH_TO_EXTENSION}`
],
});
Alternatively, you could run Chrome instead of Chromium.
executablePath is a puppeteer.launch() option that let you set a path to a browser executable to run instead of the bundled Chromium.
Option
Description
executablePath
String Path to a browser executable to run instead of the bundled Chromium. If executablePath is a relative path, then it is resolved relative to current working directory. BEWARE: Puppeteer is only guaranteed to work with the bundled Chromium, use at your own risk.
https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#puppeteerexecutablepath
In the Asp.net MVC project when using Chrome doesn't wait the method return in debug mode, but when I run in IE,MS Edge debug performe well. I verified the javascript debug option was cheked in VS. It was working before, I don't know if there was a VS update that could have caused it. Do you have
Visual Studio 2017 Version 15.9.17
Google Chrome Version 84.0.4147.89 64 bits
Asp.net MVC project when using Chrome doesn't wait the methods return
in debug mode
Please try the following steps:
1) close VS, delete .vs hidden folder under the solution folder, bin and obj folder
2) delete all caches under C:\Users\xxx\AppData\Local\Microsoft\VisualStudio\15.0_xxxx\ComponentModelCache
3) Try to reset vs settings by Tools-->Import and Export settings-->Reset All settings--> General.
And if your VS has any other extensions, pleaese disable them under Tools-->Extensions and Updates
After that, check Enable Javascript debuggigg for Asp.Net(Chrome,Edge and IE) option
4) enable all options under Tools-->Options-->Debugging-->Just-In-Time
5) try to clean Chrome caches and then test again.
If it still does not help, please try to reset settings in Chrome.
Besides, you could try to restart your PC.
I am new to automation and currently using Robot framework. I am trying to change the download location of the browser when running the tests. I tried below code and doesn't work
${kwargs} Create Dictionary download.default_directory=C:\\
create webdriver ${G_BROWSER} ${kwargs}
You can use below code
${DownloadFile}= Get File ${DownloadPath}
You can give download path(${DownloadPath}) as your wish, automatically, file will be save in that path
${path}= Set Variable ${downloadPath}
Create Directory ${path}
${CHROME_OPTIONS}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
${prefs} Create Dictionary download.default_directory=${path}
Call Method ${CHROME_OPTIONS} add_experimental_option prefs ${prefs}
Create Webdriver Chrome chrome_options=${CHROME_OPTIONS}
Use the updated suggestion for changing the download directory in the selenium library of Robot Framework.
Instead of using Create WebDriver - the Robot Framework team suggested using Open Browser Keyword to change the download directory
${prefs} = Create Dictionary download.default_directory=C:\\Balaji
Open Browser https://www.google.com/ chrome
options=add_experimental_option("prefs",${prefs})
Maximize Browser Window
Set Browser Implicit Wait 20
I have to verify some ads displayed on google search. These ads displayed only when I install the extensions for chrome browser. But when I launch chrome browser from WebDriver script it launches the browser without extentions (even though extensions are already installed) to chrome browser.
I have googled but didnt get much information.
I have tried below method but it didnt work out:
DesiredCapabilities capability = DesiredCapabilities.chrome();
System.setProperty("webdriver.chrome.driver", "libs\\chromedriver.exe");
capability.setCapability("chrome.switches", Arrays.asList("--load-extension=C:\\Users\\ashfaq.md\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Extensions"));
Please help me to resolve this issue.
You can learn how to install Chrome Extensions via ChromeDriver here:
https://sites.google.com/a/chromium.org/chromedriver/extensions
Though not tested on own end... Please check the following:
ChromeOptions options = new ChromeOptions()
options.addExtensions(new File("/path/to/extension.crx"))
options.setBinary(new File("/path/to/chrome"));
// For use with ChromeDriver:
ChromeDriver driver = new ChromeDriver(options);
// or alternatively:
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);
// For use with RemoteWebDriver:
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
RemoteWebDriver driver = new RemoteWebDriver(
new URL("http://localhost:4444/wd/hub"), capabilities);
I'm in the early stages of creating a MFT to decode a "new" container format video. I'm using the MPEG1Source sample from the Media Foundation SDK, and I have a mpeg1 sample. I changed the extensions in both to ".test" and registered the dll.
Windows Media Player can open the file (my breakpoints are hit and the video plays), but Windows Media Center doesn't- opening from the command line works when the file is .mpg, but not as .test. My breakpoints aren't hit; it doesn't look like it even tries to load the dll (Visual Studio doesn't report my dll being loaded in the output window).
This is 64-bit Windows 7; the dll is native 64-bit.
Is there some additional registration that needs to happen before Media Center will understand a new file type?
I tried using MFTrace to trace the Media Foundation calls- nothing
I tried using Event Viewer to trace Media Foundation- nothing
Finally, I tried Process Monitor- great success! Media Center does a registry scan of HKCU\Software\Classes\.test, HKCR\.test, etc, and looks for a key called "PerceivedType"- if it's "video", then it will play.
So I added the registry key HKEY_CLASSES_ROOT\.test\PerceivedType = video and it works!