Latest chromebrowser V 74 is not opening the URL in the new tab - selenium

I am using Chrome Driver(74.0.3729.6) and chrome browser( 74.0.3729.108 (Official Build) (64-bit)) for executing the script . When we launching the browser We are adding the add block plus extension using chrome option.
when the browser is launched Chrome add blocker open the below URL chrome-extension://cfhdojbkjhnklbpkdaibdccddilifddb/firstRun.html. browser new session is launched in another tab.current issue is it is not performing any activity in the newly created session which is created in the new tab. could you please let me know how we can resolve it

Related

How to add Portable Document Format (PDF) content type to Application of Firefox browser opened by WebDriver

In a web page I am working there is an icon, On clicking this icon one pop up will open and in this pop up PDF will be shown. PDF is shown inside iframe. My problem is whenever I run my script and webdriver opens the firefox browser. On clicking the icon PDF is actually auto downloading instead of showing in pop up. Below is the Browser Preference code. I am using.
FirefoxProfile fprofile = new FirefoxProfile();
String path = System.getProperty("user.dir");
fprofile.setPreference("browser.download.dir", "D:\\AutomationFramework\\ResultFiles");
fprofile.setPreference("browser.download.folderList", 2);
fprofile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/x-excel, application/x-msexcel, application/excel, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/xls, text/csv, application/pdf, multipart/x-zip,application/zip,application/x-zip-compressed,application/x-compressed,image/jpeg,image/png,image/svg+xml");
fprofile.setPreference("browser.helperApps.neverAsk.openFile","application/xls, multipart/x-zip,application/zip,application/x-zip-compressed,application/x-compressed,image/jpeg,image/png,image/svg+xml");
fprofile.setPreference( "browser.download.manager.showWhenStarting", false );
fprofile.setPreference( "pdfjs.disabled", false );
fprofile.setPreference("plugin.scan.plid.all",false);
fprofile.setPreference("plugin.scan.Acrobat","99.0");
fprofile.setPreference("plugin.disable_full_page_plugin_for_types","application/pdf;application/x-excel, application/x-msexcel, application/excel, application/vnd.ms-excel,application/xls, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
Below is applications screen shot of Firefox Browser opened by WebDriver. What should I add in Preference code so that instead of PDF auto download it should display in pop up inside iframe.
I am using Firefox version 46.
First of all, Selenium Webdriver by default is not using any firefox profile in firefox.exe -p. That means if the screen is from any of those existing profiles, it is irelevant.
Seems to missing the right mime type for PDF, but I use to access an existing firefox profile, see Automatically download pdf in firefox gecko driver using selenium java
You just need to create firefox profile manualy, modify handling PDF file also manualy and in code access the modified profile.

Is it possible to disable file download in chrome using selenium

On visiting some pages using ChromeDriver and Selenium, downloading of a particular file is happening automatically. Because of the file download, the code is not proceeding further. Is it possible to disable downloading of file using any ChromeOptions or preferences that can be set while creating ChromeDriver.
Tried the following ChromeOptions, but none helped.
prefs.put("download.default_directory", "NUL");
prefs.put("download.prompt_for_download", false);
prefs.put("profile.default_content_setting_values.automatic_downloads", 0);

Selenium: -browser.helperApps.neverAsk.openFile and savetodisk is not working

I have a critical issue over here.
Please find my scenario below:
login
click on a link
after the click, a new tab opens
I have switched the focus to the new opened tab with the following code
ArrayList<String> newTab = new ArrayList<String>(driver.getWindowHandles());
driver.switchTo().window(newTab.get(1));
The issue is that when I try to click on an excel download link on the newly opened tab, the "Open with" popup is appearing and my automation fails. Even after adding the following preference
firefoxProfile.setPreference("browser.helperApps.neverAsk.openFile",
"text/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
"text/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
Please, can you suggest a feasible solution as soon as possible?
Thank you
Please manually set these preferences in your firefox's(about:config) section, visit the application, click the link and see if the file gets downloaded without any prompt. This will help you to identify the issues with automation.
I tried setting these preferences in my firefox, but it still prompts download window. I can download without prompt only after checking "Do this automatically for files like this from now on" which updates mimeTypes.rdf file in the profile directory. So to make this work through automation, you may need to bundle a custom firefox profile that includes a mimeTypes.rdf with your TestSuite.
Here's the code to create FirefoxProfile from a given profile directory:
FirefoxProfile profile = new FirefoxProfile(new File("<PATH_TO_FIREFOX_PROFILE_DIRECTORY_THAT_WORKS_WHEN_TESTED_MANUALLY>");
WebDriver driver = new FirefoxDriver(profile);

Selenium: WebElement.click() is opening a new tab in Chrome, but new window in IE & FF

I'm attempting to automate a test case which asks to validate that clicking on a few links results in them opening in a New Tab, or New Window.
When I manually click on these links, it opens the links in a New Tab in all of the below browsers. But when I use WebElement.click(), the following occurs in each browsers:
Chrome: Opens link in New Tab (as expected)
Firefox and IE: Opens link in New Window (as opposed to New Tab, when manually clicking)
Question is: Why the inconsistency opposed to manual click? I've read that this ".click()" method is the most similar to an actual user's click. But I'm not getting the same result as when I manually click.
Chrome version: "Version 40.0.2214.91 m"
Firefox version: "40.0.3"
Internet Explorer version: "11.0.9600.17801"
Scripting language: Java
Selenium: selenium-java-2.45.0

Opening a chrome tab and get control on it from a Java app

I'm building an application to edit some html/css directly from a server. It works fine but I want to open chromium or firefox on the edited page to render the result.
I can open a new tab with the CLI with:
chromium-browser http://www.google.com
But if I re-call this command it opens a new tab.
How can I get control on the tab to close it and re-open a new tab ?
Or can I replace the url of the tab directly from de CLI ?
Thanks.

Resources