What could be the best approach to download the files from the web page using Selenium WebDriver with C#? - selenium

I am working on an application which has one module. The functionality of a module is to "opens the web page >> browse folders >> find links (.PDF/.XLSX/.DOC) and download the files on my local system".
I get stuck in this module. Can anybody tell me the best approach to accomplish the above task?
I am using selenium web driver with C# to develop the above application.

Downloading with Selenium tends to be a quagmire, especially when dealing with cross-browser compatibility; going with JavaRobot, Sikuli, or FireFox only solutions all have their own issues
I'd suggest looking at using Selenium to get to the page with the files to download and figuring the links that way, then using WGet or similar to actually download the files.
SQA.StackExchange has couple good items here. The two best options are the WGet method mentioned above, or write a download library in native code.

Related

Download HERE JS API for IDE code completion?

is there a way to download the here maps JS api 3.x to provide code completion in my IDE (like PHPStorm)?
I didn't find anything in the documentation.
Regards, Kristian
My knowledge of PHPStorm is limited, but are you able to use the javascript files by downloading them using the direct urls ?
Although you will run into issues when there are updates in the javascript file.

How to handle Flash objects using Selenium Web Driver

How to handle Flash objects to perform some actions in my application. i am unable to identify the element. can any one help me for this issue
Selenium automates Web browsers.
From http://seleniumhq.org..
Selenium automates browsers. That's it.
Flash objects are impossible to automate using Selenium as flash objects are not technically 'browser driven' like javascript is. You'll have to find other software to automate Flash.
Source - I am a contributor / maintainer of the project.
If you are using Ruby language for Selenium-Webdriver automation then you can use "Gem SIKULI" using which we can deal with all Flash elements. http://rubygems.org/gems/sikuli
But it is not that much reliable.
Gem sikuli needs Jruby i.e Java+Ruby
Not possible. All you can do is do some clicking based on the coordinates, but this is really unreliable.
It is not possible to automate flash objects with selenium as selenium is only for HTML so you can use 3rd party API Sikuli for this purpose sikuli provides image based automation in which you take image of an object and then use that image as reference to perform your operation .So in other words in sikuli object identification is done via image processing
please check following simple blog posts to learn about usage of sikuli
Automating flash calculator with sikuli integration with selenium.
Add the flashdriver jar into your project and then use the FlashWebDriver method to operate the Flash file.

Is it possible to use Selenium WebDriver to drive PhantomJS?

I’m going through the documentation for the Selenium WebDriver, and it can drive Chrome for example. I was thinking, wouldn't it be far more efficient to ‘drive’ PhantomJS?
Is there a way to use Selenium with PhantomJS?
My intended use would be web scraping: The sites I scrape are loaded with AJAX and lots of lovely JavaScript, and I’m thinking this setup could be a good replacement for the Scrapy Python framework that I’m currently working with.
PhantomJS now includes the GhostDriver project.
You are also suggested to use PhantomJS directly or with a convenience library such as CasperJS. CasperJS is specifically designed to make it easy to do sequential operations to web pages, perfect for many automation tasks.
Disclaimer: I am the author of PhantomJS.
Edit: As noted in Nick's answer, GhostDriver is now included in PhantomJS.
#Joseph, since the 1.8 release GhostDriver is included in the stable release of PhantomJS. Here is the exact release notes: http://phantomjs.org/release-1.8.html.
You can simply start PhantomJS process to listen on some port, like this:
phantomjs --webdriver=PORT
Kudos to #detro and PhantomJS team for awesome work!

Testing a file streaming with selenium?

Is it possible to test a webpage which supports an export mechanism? This export mechanism streams the data displayed in a table via xml to the user. For now it's sufficient to test if the streaming works and the user receives a file, regardless of the file content. Any ideas how I can achieve this with selenium?
I googled around for a while, and according to selenium core FAQ, u may need to use firefox template to do that.
u may take a look of this:
http://oopsnullpointer.wordpress.com/2011/01/14/selenium-handling-testing-downloads-with-a-custom-profile/
I have not yet personally tested that though.
If you're using Selenium script by itself, this would be hard, if not impossible. Luckily, you can run selenium from Java, C# and more and have it integrate with JUnit, NUnit or your favorite unit testing framework. If you use one of these languages, you could use it to cause selenium to export the file to a specific location, then use C#/Java to actually go out on the file system and verify that the file was correctly exported to the location, and do any other validation on it.
For doing this development, you can typically find all the client libraries under the bin directory of Selenium server. If you're using Selenium IDE, you can even export your test cases to C#, Java, Ruby, or whatever else, or just use it as an example to manually write your own in code.
Hope that helps!

Any good command-line tools (for a build server) for validating websites?

My team creates a number of dynamic/data-driven websites. We use a CruiseControl.NET to download the code, create test data, run unit tests, and install each site into IIS for manual testing. However we haven't found a good tool (or tools) that can actually run through some simple tests of the websites, such as checking for broken links or invalid HTML.
Are there any good tools that we can incorporate into our build process to automate basic website testing? E.g. check for broken links, check for HTML/JavaScript/CSS coding errors, and so on? Load testing would be great too.
Looking for something totally generic; we don't need to write/record scripts for playback. Just something to cover the basics.
Thank you!
-James
For link checking you could always look at http://linkchecker.sourceforge.net/ if that isn't suitable they list other alternatives.
It also seems like it is an active project.
JSLint does javascript validation and there are two options for executing it via the commandline so that might be worth a look too http://www.jslint.com/