I want to view the HTML source of a web page, I've using ICSharpCode.TextEditor, Scintilla,... and they're all good. But, I have missed Firefox HTML source viewer.
I wonder if I can use Mozilla ActiveX Control to open the source viewer or is there a command line argument that make Firefox open it? Thanks!
You can do that from the command line like:
$> firefox view-source:http://stackoverflow.com
Or you can put something like this in the URL bar: "view-source:http://stackoverflow.com"
If you happen to want to open it in a new window:
$> firefox -new-window view-source:http://stackoverflow.com
There is a reference at mozillazine.org.
Related
While on a scrapy shell, when I try to use the view(response) function, instead of opening a browser, it opens Visual Studio Code. How to make it open on a browser?
I read that webbrowser is the library used to view the page and that I could set the BROWSER variable to change its default. On a Linux Mint system, to which value should I change the BROWSER variable to in order to make the view command to open firefox?
Found the answer myself after some further searching.
The value of the BROWSER variable should be /usr/bin/firefox.
So, in my case, adding the following line to my ~/.bashrc file did the trick:
export BROWSER=/usr/bin/firefox.
My Testcase execution result will be displayed in the form of .html.
When I double click and open the .html file, the testcases results
along with the Pass or Fail screenshot will be displayed.
I am executing the selenium testcases in Mozilla Firefox browser
When I open the .html file from my local machine, the images for
every are loaded without any errors.
When I try to open the same .html file from any other system, images are not loaded.
Can somebody help me out in this issue?
I believe you are not able to view HTML properties of your HTML reports. This is working fine as per default Jenkins behavior.
Run below in Script Console (available in Manage Jenkins) to view HTML and CSS properties:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
I have to automate a scenario like a upload an image from windows explorer to TinyMCE component using Selenium. Since Selenium does not support OS control, I used AutoIt to upload the image.
AutiIt sets the image path to "File name" and seems like it clicks on 'Open' button as well. But the image is not loading to my "source" field.
Here is my Selenium command:
Runtime.getRuntime().exec("C:/XXXXX/src/test/resources/uploadImage.exe");
// Path of the AutoIT script file
AutoIT script:
WinActivate("Open")
Send("C:\LCNGProjects\Screenshots\Images\GifImage1.gif")
Sleep(5000)
Send("{ENTER}")
Refer the attached screenshot
Not sure if I have got the questions correct, Did you compile the script.
Can you please go through link below for script compilation and step by step info how to upload a file.
https://www.guru99.com/use-autoit-selenium.html
You do not need to use AutoIt. Auto will make your script dependable on windows machine only.
Instead of it find element using locator(i.e. xpath) of upload button which is having tag as type="file". Now pass this simple sendKeys with absolute path of your image in your machine like below:-
button2.sendKeys("C:\\UsersDesktop\\logo\\Summit-Logo-900px.png");
Or use
System.getProperty("user.dir"));
Append the path of file exluding your project path and filename inside your project
Example :-
button.sendKeys(System.getProperty("user.dir")+"\\logo\\Summit-Logo-900px.png");
below link contains more option to upload file like below :-
Using SendKeys command.
Using AutoIt scripting.
Using Jacob com interface.
http://www.techbeamers.com/handle-file-upload-selenium-webdriver/#h3
Hope it will help you :)
I'm not going to add full source code here. You can call the AutoIT script using this command inside your test case.
// Call to AutoIT script to upload the image
Runtime.getRuntime().exec("C:\\xxxxx\\src\\test\\resources\\uploadImage.exe");
AutoIT Scrip
ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1","C:\xxxx\Images\jpgImage")
ControlClick("Open","","Button1")
For more information refer the following link
https://www.guru99.com/use-autoit-selenium.html
Steps: open the Browser > enter URL http://seleniumhq.org >
Click Download tab > click Download version “2.46.0” link
It opens a dialog window. Click “Save File” button
Note: I have tried download *.xls file example code from URL: http://seleniumeasy.com/selenium-tutorials/how-to-download-a-file-with-webdriver it is working fine in my system. It automatically handling the dialog box and saving the file in destination location.
But the same code not working to download the *.jar file.
Could you please look into this one and help me to resolve this?
If you are downloading Selenium Standalone Server try this:
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive");
If downloading selenium java webdriver:
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/zip");
Here is a nice link for a detailed list of file format MIME type list: ClickME
I'm running Intellij 13 Ultimate. I'm trying to open a web page I'm working on, and it's opened from the file system:
file:///Users/<username>/dev/index.html
Instead of something like:
http://localhost:<port>/index.html
Thing is, other projects run as expected and I can't figure out what's misconfigured in this specific project.
How do you open the page?
If you open your HTML file inside IntelliJ and go to Run > Run xxx.html (or Debug), a localhost page should be opened. If it isn't, check your Run Configuration (Run > Edit Configurations) and check the URL field.
View > Open in Browser should also work as expected.