Selenium WebDriver - Way to change firefox file save location - webdriver

Is there a way to change the location where firefox saves downloaded files using selenium webdriver?
Anyone have selenium web driver code to change the location where firefox saves the downloaded files?

if you know how to use Firefox profiles with custom preferences,
then the setting you are looking is "browser.download.dir"
fProfile.setPreference("browser.download.dir", #your_dir);
have look at more Firefox download options and other configs # http://kb.mozillazine.org/About:config_entries

Related

Troubleshoot ASP.net WebForms download file problem

In my webpage, I have a download button will write excel to response and it work previously. But I got a problem today that browser on client (tested IE and Chrome) cannot download exported excel from ASP.net webforms suddenly without changing code and software install.
When I test in Chrome, console show that Resource interpreted as Document but transferred with MIME type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
I used the notepad to open the downloaded excel and the content become the my web html page.
I tried to login server and use the browser in server, the file can be download normally with correct content.
I have tried to copy the web folder to another server and iis setup, it show same behavior that the downloaded excel become html content of my page on client browser but work in server browser.
May I have any idea how to troubleshoot on this case please?
Thanks
Are you facing this issue on a domain/managed network? If yes, are you the administrator of the network? If that's not the case, please give these suggestions a try:
If you’re using an antivirus or firewall software, make sure Chrome
is trusted or allowed by these programs. You can also try
temporarily disabling your antivirus or firewall to see if this
resolves the issue.
Just to make sure we eliminate malware from the
scenario, please follow the steps from this help article.
Try resetting the Chrome browser to see if that helps.
Also, creating a new user profile on your Chrome can be helpful.
If the issue persists, download and run Chrome Canary. It is the
cutting edge developer version of Chrome that can be installed
alongside Stable Chrome. It's possible the problem won't exist on a
future version.
refrence article

How to host a "local" webpage without needing to make it a real webpage?

I've tried finding an answer on the web and google for this but it just tells me how to HOST a webpage and I don't want anyone else to get to this webpage. I want to be able to write my HTML and CSS and see it before having it put anywhere.
How do I go about doing that?
You do not need to "Host" a webpage to view it (unless you are using server side code).
Just save your file with the .html extension and then open it with your web browser.
You can use WAMP or XAMPP for running a local testing.
If you are using just HTML and CSS you don't have to host it. Just open the *.html file in the browser from your local storage with relative paths to your CSS/images.
If you want to use PHP for example (server side code) you can install XAMPP, a free and open source apache distribution as popular develop environment.

How to save CSS directly from Chrome developer tools?

I work on a local web site project and i use google chrome for testing my css.
So i want to know how can I save the changes I make in chrome css tool to my project, because i have always to copy and paste the css i put to google chrome in my file .css.
Navigate to this stylesheet in the Sources panel of the Developer
Tools, Right-click it, and Save-As this file to your computer
see here for more info
You can use special tools like Emmet LiveStyle http://livestyle.emmet.io/ so that you can edit code in Chrome and it will be automatically saved to your css files (There are more than one of them)

.HTA file source code displayed

I have written the script in a .hta file and saved it on an apache server.
Then I hit the appropriate url stating the hta file.
In IE8 the file is executed and prompts for open, save, saveas.
But in Mozilla and chrome the content of the hta file is displayed in the browser
Have you configured the mime type for HTA correctly in Apache (it ought to be application/hta)?
IE 8 is probably compensating, but, Chrome and Firefox probably have no idea what it is. With the correct mime type being set in Apache, then, Chrome and Firefox will more likely react in the way you expect it to.

Preview ASP files without server

How can I get any browser to just treat a .asp/.aspx file as if it was .html and render it? (Without installing ASP server). It always pops up with a download box or displays the source.
Preferably for IE8. On Vista.
Thanks.
What about Visual Web Developer 2008 Express? It's a no-cost way to develop and view ASP.NET pages.
I know how to do this in Firefox (i.e., with the awesome force content-type firefox extension!), but I don't know how to do it in IE8.
You can just "render .asp" files in a browser like an HTML file. Browsers don't "speak" ASP.
ASP files contain scripts which are executed on a server so you have to have the server installed to get back the results you want.
I realise you wanted server-less, but in light of forcing a browser to render and ignore server side tags, as an alternative you could use Cassini web server - it's very lightweight and portable and you can still edit the asp/aspx files directly and it will render fine in a browser..
I'm with Robert Cartaino on this: you won't see what you expect to. But since these are your files, you could just temporarily re-name them to *.html and see what you get.

Resources