The FileDownloader class provided on the question below worked fine until I upgraded to selenium 2.46:
Programmatically downloading a file using Selenium in Java
When I run the same test with selenium 2.46, I now get redirected to the login page. Did anyone else face this issue?
The Selenide project has a great, really well thought out, download helper in it. I would investigate that, either as an example, or possibly actually using it.
$.download()
Related
One of the ways WebDriver identifies itself as a bot to external websites is by setting the webdriver-active flag to true.
A user on SO suggested that it is possible modify Chrome Driver source code to remove all bot-identifying attributes (see this and this response).
Is it possible to achieve a similar outcome w/ Firefox by modifying the source code of Geckodriver, Firefox WebDriver or perhaps both? I'm asking because there is currently no way to conceal WebDriver using Firefox Options without source code modification.
If we can somehow remove bot identifying features from the source code, we can prevent WebDriver from being identified as a bot without needing to bundle TOR with Firefox.
While there's no getting around the fact that Selenium (in its present state) identifies itself, surely we can modify source code to remove all identification similar to how it's achieved in Chrome Driver?
In the discussion Can a website detect when you are using Selenium with chromedriver? as suggested by different users to open the ChromeDriver in a Hex Editor and edit the document variables replacing the cdc_ and $wdc_ string might be possible, but achiving the same with GeckoDriver may not be possible.
Moreover, the commands like execute_cdp_cmd() and Python libraries like selenium-stealth may not be currently supported by GeckoDriver.
The GeckoDriver source code can be easily downloaded from mozilla / geckodriver page both in zip and tar.gz format. If you are on windows system you can unzip the downloaded file and find the the source code of different modules in the ...\geckodriver-0.30.0\src directory:
Additionally, geckodriver is made available under the Mozilla Public License. GeckoDriver source code can also be found in mozilla-central under testing/geckodriver.
WebDriver Specifications
Now as per WebDriver W3C Editor's Draft:
The webdriver-active flag is set to true when the user agent is under remote control. It is initially false.
So there can be two possible ways to keep webdriver flag as false as:
Remove the readonly attribute, so can be edited runtime. (as discussed in this answer)
Strangle the WebDriver from emitting the signals that the user agent is under remote control.
To me the second option looks pretty much viable as the most frequently updated tier is the second tier (Selenium WebDriver.dll and WebDriver.Support.dll modules). Since App Studio uses C# and .Net version 4.0 (before Selenium 4.1.0 (November 22, 2021)) to communicate with Selenium, you need to download the .Net 4.0 version of the Selenium modules. The current stable version being 4.1.0. Once the zip file is downloaded, extract the content to a folder and navigate to the net40 subfolder.
Now, you can copy the WebDriver.dll and WebDriver.Support.dll files to the bin folder of the App Studio installation. e.g, C:\ibi\AppStudio82\bin and make the required changes.
As an alternative, you can also download the NuGet, copy the .Net 4.0 content of the NuGet package into the bin folder of the App Studio installation and make the required changes.
tl; dr
Building geckodriver
Testing geckodriver
I came through a scenario where i have to check if someone click a link to download something it is downloading properly.. Using selenium is there anyway i can check if it trigger the downloading by clicking the link??
thanks
With WebDriver you can detect and test any UI changes caused by clicking a link - if the application provides any. E.g. some text appeared your download was started or so.
But you'll need to use another approach to test if actual content was downloaded - e.g. test whether a file with certain name appeared in file system. You cannot do this with WebDriver directly - use Java files I\O or other libs for that.
I have a general question about selenium:
Is there a way to run selenium webdriverv2 using java, in different browsers(chrome\firefox\safari...) without opening any browser?
I read about selenium grid, unfortunate in grid it open the browsers/machines.
If you dont want to open a browser, then Selenium isnt for you. If you want headless testing my suggestion would be to look into CasperJS.
I don't use Selenium for 6 month, but when I used it, it was necessary to open the browser and I think still being like that today.
I'm writing Selenium tests using Java + Maven + Selenium WebDriver. Our customer wants these tests in such a way that they can run tests easily without much technical stuff needed.
I've all my tests under src\test\java folder. Is there any way where I can give jar file or so to the customer and they can run tests by simply clicking on it or by hitting some command on the command line.
Please point me to documentation or video using which I can achieve this.
I've been using Visual Studio to write my Selenium tests in C#. I am able to build my project to a console application in Visual Studio that contains the required files like the Chrome webdriver. It can be run from this single application file with one click. The console then prints out if the test is a success or if their are any exceptions. You should also be able to integrate a headless browser like selenium has on their site. This would allow the test to be run with one click and no browser will pop up while the tests are running.This is all the experience I have and it has worked well for me. Hope that this information can help a little.
I have created a set of test cases using Firefox Driver in Eclipse IDE.
But now I need these test cases to run without opening the browser window. How can I achieve that?
Presently I am using Firefox Driver Web Driver that runs in Firefox Browser.
Can some one help me with an example?
If you do not need to think about compatibility of different web browser, you could try Celerity. It could be run automated test script without any browser window.
http://celerity.rubyforge.org/
It is based on JRuby, and is very easy to learn and use.