Accept downloads automatically in Selenium WebDriver using IEDriver - selenium

How I can accept downloads in Selenium using InternetExplorerDriver.
Now when click to download file, Save As Dialog appears and then WebDriver stop the work.
I try to search a capability to set this how in ChromeDriver is just only add chromedriver.AddUserProfilePreference("download.prompt_for_download", false);
but I not found.
I need when driver click in button to download, the download automatically start and save in any folder.
Sorry my bad question. I'm new here.

I don't have windows machine so i couldn't check this but try following article. There is a registry which you need to modify to get such behavior. Let me know if it works.
https://jwcooney.com/2014/03/31/remove-internet-explorer-open-or-save-popup/
found another thread discussing the same thing
https://superuser.com/questions/246553/how-to-disable-file-download-popup-in-internet-explorer

Related

I have a problem to scrape link with PhantomJS form this link

The Problem
I'm trying to take out the link of the video. The problem is that I need to perform a click on the video to generate the link, but ads apear and don't let me click on the video media player.
So, I need to understand where is the ads to click on them to make them disappear, or disabled them.
Thanks to the person who would like to help me.
PS : I need to use PhantomJS (Headless Browser) cause I don't want persons to install Chrome.
Code
WebDriverManager.phantomjs().setup(); // WebDriver
WebDriver driver = new PhantomJSDriver();
driver.get("https://down-paradise.com/v/13k82cj8l-g68x4");
driver.findElement(By.xpath("//div[#class='playbox']")).click();
driver.manage().timeouts().implicitlyWait(6, TimeUnit.SECONDS);
driver.get(driver.findElement(By.xpath("//iframe[#class='metaframe rptss']")).getAttribute("src"));
System.out.println(driver.getPageSource());
driver.quit();
PhantomJS was discontinued by the author on March 8th, 2018. You should consider an alternative such as ChromeDriver, GeckoDriver, or EdgeDriver in headless mode.
If you are having issues with the web page crawling, you can run your browser with a browser window to double check everything is getting selected correctly. Once you are finished, you can run it headless.
EDIT:
After looking at the Github for PhantomJS, it would appear that the author has decided to begin working on PhantomJS 3. Perhaps the project is not closed after all.

chrome always open these type of links in associated app checkbox is missing in selenium

When I opened selenium with python, I can't find the always open these kinds of links with associated app checkbox anymore.
People suggested me to use the registry editor to enable it and yes it worked but when I opened the selenium again with my python script it doesn't work! As in don't work I mean the checkbox is displayed but selenium doesn't remember it anymore. Any suggestions?
Ooo , i think i know what your problem is. The reason why selenium doesn't remember your changed settings was because you don't use the same chrome profile in your python script. Try this:
options = Options()
options.add_argument(r'user-data-dir=path\to\your\chrome\profile')
driver = webdriver.Chrome(executable_path=r'path\to\your\chromedriver.exe', options=options)```
If you don't know how to check your profile, go to your webbrowser and type chrome://version and scroll until you can find the profile path subheading! Cheers, and good luck.

Selenium Chrome WebDriver is opening Setting as default tab asking to reset the setting

Selenium Chrome WebDriver is opening Setting as default tab asking to reset the setting.
I too faced this issue, fixed it by following below steps.
Run regedit command using window+r shortcut.
Registry Editor will opens then perform below mentioned.
There is a setting in the registry that's causing it.In the registry it's
under HKEY_CURRENT_USER\Software\Google\Chrome\TriggeredReset
Delete the TriggeredReset key and then close regedit.
Let me know if it works for you.
For macs, I solved this problem by updating chromedriver via brew upgrade chromedriver
This was an issue with latest Chrome on mac when driving UI with selenium. I installed previous version of chrome (59) on my mac, you can get here - http://google-chrome.en.uptodown.com/mac/old. I also turned off auto-updates by running the following in the command line:
defaults write com.google.Keystone.Agent checkInterval 0
To deal with this issue please delete TriggeredReset entry from Chrome registry as mentioned below:
Open a run box by pressing Windows key ⊞+R:
Type regedit and press OK, Registry Editor will open.
There is a setting in the registry that's causing it.
In the registry it's under: KEY_CURRENT_USER\Software\Google\Chrome\TriggeredReset
Delete the TriggeredReset folder (the whole folder which contains 3 files) and then close regedit.
Try running you test again.
The same thing happened with Chrome Version 62.0.3202.94, when the browser automatically updated. It was easily fixed when I updated chromedriver in my automation framework.
Just download new version of chromedriver from: https://sites.google.com/a/chromium.org/chromedriver/downloads
and put it to your Drivers folder in your framework.
I have version 62.0.3202.94 and I've tried updating my chrome driver using webdriver-manager update --versions.chrome 2.33 but when i run my protractor tests it still keeps opening tabs for chrome:settings/help during the tests even if I keep closing them.
For some users it's been observed that LEAPWORK opens two browser tabs in Chrome, one of them is the settings and the other tab is the Url specified in Start Web Browser. This issue won't let you proceed until you click CANCEL and Navigate to the Url again. Resetting browser is also not going to help you.
This issue belongs to Chrome browser registry, and it usually occurs when TriggeredReset entry resides in Chrome browser's registry.
Resolution
To deal with this issue please delete TriggeredReset entry from Chrome registry as mentioned below:
1.Open a run box by pressing the Windows key + R:
2.Type ‘regedit ’ and press OK, Registry Editor will open.
3.There is a setting in the registry that's causing it. In the registry it's under HKEY_CURRENT_USER\Software\Google\Chrome\TriggeredReset
4.Delete the TriggeredReset key and then close regedit.
Try running you test again.
Cheers:)
Try out the following steps:
Kill all the chromedriver instances running in your windows Task Manager.
Clean all the projects in Eclipse.
Restart your system once.
Provide the following options to start your Chrome browser:
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("--js-flags=--expose-gc");
options.addArguments("--enable-precise-memory-info");
options.addArguments("--disable-popup-blocking");
options.addArguments("--disable-default-apps");
options.addArguments("test-type=browser");
options.addArguments("disable-infobars");
driver = new ChromeDriver(options);
Your program should work with latest chrome driver 2.28 & Chrome Version 57.0.2987.110 (32/64-bit).
Let me know if this helps you.
try this. it worked when I had the same issue:
npm install selenium-standalone#latest -g
selenium-standalone install
selenium-standalone start
this is best solution
Resolution
To deal with this issue please delete TriggeredReset entry from Chrome registry as mentioned below:
1.Open a run box by pressing the Windows key + R:
2.Type ‘regedit ’ and press OK, Registry Editor will open.
3.There is a setting in the registry that's causing it. In the registry it's under HKEY_CURRENT_USER\Software\Google\Chrome\TriggeredReset
4.Delete the TriggeredReset key and then close regedit. Try running you test again.
Cheers:)

Selenium scripts fail after newest Windows update

I have a question regarding Selenium and the current Microsoft updates:
I just installed the newest Microsoft patches on a PC and now the Selenium scripts won't work anymore. I'm using the Selenium IE Driver 2.44.0 in the scripts. Maybe something has changed in the Internet Explorer, I'm not sure. Suddenly the scripts can't find any web elements on the page anymore. An InvalidSelectorException is thrown because the findElements methods can't be executed. The IE driver opens up and it navigates to the given URL, but when it tries to find a web element, the script fails. I also tried it out on a PC which hasn't the newest updates installed yet and the scripts are working fine there, there are no problems at all.
Do you have any ideas what to do or what could be the cause?
Thanks a lot!
Yes as I stated here
If you have taken windows update KB3025390 IE will not work as expected. There is currently no resolution to that yet.
Also, Uninstalling the update KB3025390 should make the WebDriver work correctly with Internet Explorer 11. See this answer

Robot Framework browser support

Has the robot framework support for IExplorer or only for Firefox and Chrome?
(If yes, how to configure it?)
Thanks!
Robot Framework does not, in itself, support any particular browser, so I am guessing you are referring to either SeleniumLibrary or Selenium2Library which use selenium and selenium 2 respectively. The browser support of these is well documented at seleniumhq and there is much support out there. It is recommended for new projects to use Selenium2Library as this will receive ongoing support.
Please check the driver compatiblity for browser.
You might have already known of IE driver.
Apart from that you also need to check Python version- Selenium2 version - IE Driver version - IE browser version compatibility.
In addition to #theheadofabroom 's answer, I should add that Internet Explorer does not play well with Robot Framework. Your test might not work for any number of reasons on IE while it may work just fine on FireFox and Chrome, but the most common is timing. IE is just slow enough that when Robot Framework goes to click on the next element, it searches the page for it, but it hasn't loaded in yet. As long as you have the Selenium webdriver for IE installed correctly and have written your Robot Framework code correctly, I'd recommend adding some Sleep keywords between actions to slow your code down and increase the probability that the element you want to click will load before Robot Framework searches the page for it. This is especially true if you're writing for Chrome and want to send it to either Firefox or IE.
Open Browser ${WEBAPPURL} ${BROWSER} is the keyword to open the browser.
For Firefox you can use firefox/ff instead of ${BROWSER}
For Google Chrome you can use googlechrome/gc/chrome instead of ${BROWSER}
For Internet Explorer you can use internetexplorer/ie instead of
${BROWSER}
For Firefox you don't need any driver but IE and Chrome you need to install the drivers
You can find the installers in and info here for Chrome and here for IE
Download IEdriver exe from here and put this exe file in Scripts folder of your Python installation directory. For eg, in my case it is C:\Python27\Scripts.
Ride will now launch IE for you.
Robot class supports keyboard inputs regardless of the browser. It is a class from the java.awt package and not specific to any browser. It is used in automation for performing operations on the web browser(stand alone application) in which a web-page is being automated
Note that it cannot perform operations directly on the web browser as it's a stand alone application, but can make use of keyboard shortcuts to indirectly perform the operation.
For example, if you want to open a new tab in a browser, you can use the Robot class to press Ctrl+t instead of trying to click on the new tab.
Code to use it to open a new tab in your program
Webdriver driver = new ChromeDriver(); //FirefoxDriver(), IntrrnetExplorerDriver();
driver.get("......");
//code goes here
//to open a new tab
Robot rob = new Robot();
rob.keyPress(Keys.VK_CTRL);
rob.keyPress(Keys.VK_t);
rob.keyRelease(Keys.VK_CTRL);
rob.keyRelease(Keys.VK_t);
//itetator to switch between the tabs