Fitnesse is opening the startpage of Firefox but not the specified URL in the script.
https://www.mozilla.org/nl/firefox/42.0/firstrun/learnmore/
what can i do to solve this problem?
The solution is:
go to this URL and install.
(install a Crome webdriver)
https://code.google.com/p/selenium/wiki/ChromeDriver
Related
I'm testing file download in multiple browsers. In Chrome it downloads as expected, but in Firefox the folder used is not the default cypress/downloads folder.
DOM
<a data-cy="download-png" href="logo.png" download>logo.png</a>
Test
cy.get('[data-cy="download-png"]').click()
Chrome:
(download) C:\ ... \cypress\downloads\logo.png
Firefox:
(download) C:\downloads\logo.png
Do I need special configuration or plugin for Firefox?
This is a known issue, see Cypress is not downloading files in the cypress/downloads folder on Firefox.
If you upgrade to Cypress v10.6.0, it should be resolved.
I am trying to install an add-on on Firefox, however, I couldn't achieve it with whatever I've tried.
require 'capybara'
require 'selenium-webdriver'
Capybara.register_driver :selenium_proxy do |app|
desired_caps = Selenium::WebDriver::Remote::Capabilities.firefox
options = Selenium::WebDriver::Firefox::Options.new
profile = Selenium::WebDriver::Firefox::Profile.new
# Here is the add-on I am trying to install.
profile.add_extension('/home/user/Downloads/try_xpath-1.3.5-fx.xpi')
options.profile = profile
Capybara::Selenium::Driver.new(app, {
browser: :firefox,
desired_capabilities: desired_caps,
options: options
})
end
browser = Capybara::Session.new(:selenium_proxy)
browser.visit 'https://google.com'
What am I doing wrong here? The browser visits the URL without installing any add-on. I am able to install an add-on manually from the file.
Moreover, when I want to add a profile I get the error below:
Errno::ENOENT: No such file or directory # rb_file_s_stat - /tmp/webdriver-rb-profilecopy20200815-25523-ie6apk/lock
from /home/burak/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubyzip-2.2.0/lib/zip/entry.rb:405:in `stat'
Well, since noone has answered yet I will share how I've overcome this problem in case you want to install extensions.
If anyone else has a better answer then I can accept their answer, so please answer if you have a better solution.
1st Method
I was just messing around with the Firefox profile folders and I figured that I could use an already existing profile folder with only the extensions folder in it. So I've deleted all the other files/folders in the profile folder that I wanted to use.
So basically the steps are:
Create a Firefox profile or use an existing one.
Install your desired add-on using the browser with the same profile.
Close the browser.
Navigate to the same Firefox profile folder and delete all the other files/folders in the profile folder.
Then use the path to that Firefox profile folder when you are instantiating a Selenium::WebDriver::Firefox::Profile like so:
Capybara.register_driver :selenium_proxy do |app|
desired_caps = Selenium::WebDriver::Remote::Capabilities.firefox
options = Selenium::WebDriver::Firefox::Options.new
profile = Selenium::WebDriver::Firefox::Profile.new '/path/to/firefox/profile/folder/'
options.profile = profile
Capybara::Selenium::Driver.new(app, {
browser: :firefox,
desired_capabilities: desired_caps,
options: options
})
end
browser = Capybara::Session.new(:selenium_proxy)
browser.visit 'https://google.com'
I've tried to create a folder named profile and inside that folder I've created another folder named extensions the same way Firefox does and moved all the add-ons I wanted to upload into that extensions folder but that didn't work.
I guess Firefox changes the add-on file when installing the add-on so downloading an add-on from their website and trying to use it in the profile folder doesn't work. This is my guess of course.
2nd Method
You could alternatively use:
browser = Capybara::Session.new(:selenium_proxy)
browser.driver.browser.install_addon '/path/to/addon.xpi'
I know this looks messy so you could just stop using Capybara and use selenium directly but Capybara has some cool methods as well.
Is there a way to work on Firefox with selenium 3.4 as
I am always getting error as below:-
"FirefoxDriver cannot be resolved to a type"
WebDriver will support the latest firefox also. but you have to set the properties for that
download "geckodriver.exe" file and download the file from below URL :-
https://github.com/mozilla/geckodriver/releases
System.setProperty("webdriver.gecko.driver","E:\\SeleniumAutomation\\geckodriver-v0.9.0-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://stackoverflow.com/");
Update your firefox and selenium server and client-combined jar
I've made a local file (log.html) in Firefox profile and tried to open it in an add-on page (add-on folder/data/log.html and it's shown as Resource protocol in URL bar).
self.port && self.port.on('add-log-path', function(payLoad) {
addLogPath(payLoad);
});
function addLogPath(url) {
// url == "file:///Users/usr/Library/Application Support/Firefox/Profiles/05rhodfg.cfxo/log.html"
$('#logpath').attr('href', url);
}
I've also tried changing that to JS method window.open
function addLogPath(url) {
$('#logpath').on("click", function() {
window.open(url);
});
}
But the error is
JavaScript error: , line 0: Error: Access to
'file:///Users/usr/Library/Application%20Support/Firefox/Profiles/05rhodfg.cfxo/log.html'
from script denied
BTW, before Firefox version 41, it has no problem doing this.
Can you suggest other workaround to solve this? Thank you!
edit:
added add-on example to reproduce the problem
download and run the following statement in Terminal:
$ cd fileProtocolExample && cfx run
Do self.data.url('filename_here') to get that path to your file.
It will look something like resource://your-extension-id/data/filename_here, then this should load fine. That resource:// in front is important, make sure you get and use that URL.
The file:// won't work, because your addon is packed in a zip. Its not extracted into the system. How did it work in Firefox 41? Was your addon unpacked at that time? This is an Addon-SDK addon right?
I wrote a few tests with casperjs. They run just fine with phantomjs. However, when I tried to use slimerjs with the following command:
casperjs --verbose --engine=slimerjs test create-project-suite.js
A small window appers with the SlimerJs logo and version number but the console seems to hang with the following line:
Test file: create-project-suite.js
Is there anything else I need to do? Here are the version numbers:
Mozilla Firefox 28.0
CasperJS version 1.1.0-beta3
Innophi SlimerJS 0.9.1
3.8.0-37-generic #53~precise1-Ubuntu
Update:
I removed code until I got slimerjs to open the browser and execute tests. It seems that it hangs whenever I require a js file (I'm following the page objects pattern):
var Login = require('./objects/login');
I think require.paths could be helpful. Any ideas on how to get around this?
Using full paths makes slimerjs happy:
var path = fs.absolute(fs.workingDirectory + '/objects/login');
var Login = require(path);
It is plain simpler to move all modules to the same directory where the script is.
I tried your command and it works for me, maybe in your file you use an instruction specific to phantom :
http://docs.slimerjs.org/0.8/differences-with-phantomjs.html
But it should open the window(at least the start() ).
Anyway the command is fine.