I have some issue with selenium-webdrivers on Ubuntu. Everything is working fine instead firefox has no javascript activated. When I open a website that requires javascript it pop the noscipt error. So the website is displaying <noscript>Javascript is required ....
Is there a function to enable JS on Firefox on Ubuntu or das this is a selenium failure and I need to set a driver.
Code:
require 'rubygems'
require 'headless'
require 'selenium-webdriver'
#headless = Headless.new
#headless.start
#driver = Selenium::WebDriver.for :firefox
#driver.navigate.to 'URL'
... actions
#headless.destroy
The Website navigate over HTTP:Headers and Ajax I think.
If someone have an idea I would be thankful.
On dev machine (win 10) all working fine.
Regards
Mat
EDIT
With recent modules you need firefox 65+, because firefox 65+ has his own headless module. Now everything is working fine and fast. Also need recent Geckodriver. Poorly not working with old firefox versions.
Refer comment here...
An alternative is to install a Firefox addon that disables JavaScript. This worked for me with Firefox 45 ESR, selenium-webdriver (2.53.4), and capybara (2.8.1):
profile.add_extension(File.expand_path('../quickjava-2.1.0-fx.xpi', FILE))
Configure the extension to disable JavaScript by default.
profile['extensions.thatoneguydotnet.QuickJava.startupStatus.JavaScript'] = 2
Disable loading the extension's first-run tab.
profile['extensions.thatoneguydotnet.QuickJava.curVersion'] = '2.1.0'
Reference : Disabling JavaScript when using Capybara + Selenium
Related
I'm running my protractor tests with Chrome and i'd like to run them with Firefox too. Problem is I can't find how to enable CORS in firefox like I do in Chrome.
This is my configuration for Chrome:
capabilities:{
'browserName': 'chrome',
'chromeOptions': {
'args': ['--disable-web-security']
}
},
Hate to say it but FireFox doesn't have similar functionality.
In fact, out of the main four browsers (Chrome, Safari, FF and IE), only Chrome and IE will allow you to run with web security disabled and only Chrome from the command line.
Source: I spent a lot of time looking for a way to run each of these browsers with CORS security disabled and failed on all accounts except for Chrome and IE.
with selenium webdriverjs we can use this
npm : https://github.com/saadtazi/firefox-profile-js
var FirefoxProfile = require('firefox-profile'),
webdriverjs = require('webdriverjs');
var fp = new FirefoxProfile();
fp.setPreference("security.fileuri.strict_origin_policy", false);
And this is the link to set specific firefox profile for Protractor
https://github.com/juliemr/protractor-demo/tree/master/howtos/setFirefoxProfile
I have a program that tests some of our sites with javascript disabled. It worked well, until we updated from WebDriver 2.4.5 to the latest. Now I get this error:
java.lang.IllegalArgumentException: Preference javascript.enabled may not be overridden: frozen value=true, requested value=false
It looks like the argument to disable JS is no longer allowed. I can't downgrade the WebDriver because the earlier versions don't work correctly with our updated Firefox.
What are my options for testing with JS disabled? I know Chrome never worked before, and now Firefox doesn't. I tried searching for "webdriver js disabled" but the results just bring back the javascript.enabled, false argument that no longer seems to work.
Best I could come up with is;
Create a new Firefox profile called NoJs by starting it with -P
Go to about:config and disable javascript there
Use this profile in selenium
ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile = allProfiles.getProfile("NoJs");
WebDriver driver = new FirefoxDriver(profile);
I have developed application in mvc 5 from where I need to open next web application from link which runs only in IE < 9 ;but my application runs in firefox and is NOT supported in IE < 9. So I managed to open the application from Process.Start("IExplore.exe", http); which works fine in debug but while application is hosted it doesn't work. So I need a solution to open application from firefox in IE using backend c# code or javascript.
You can use the below
Process p = new Process();
p.StartInfo.FileName = "iexplore.exe";
p.StartInfo.Arguments = "http:\\\\www.google.com";
p.Start();
This will open Internet Explorer, and immediately load the website passed in as an argument.
Also, the Process class is part of the System.Diagnostics namespace. Be sure to reference it at the top of your code file.
if you are using windows 8 or higher then you can use
System.Diagnostics.Process.Start("IEXPLORE.EXE", MyURLHere)
The JSON script below is working fine on my development machine.
Now, I have hosted this MVC ASP.NET site on IIS 7.5 on Windows Server 2008 R2.
It shows many 'CSS not working' (specifically for JQGRID). Also it shows the ERROR below.
I also faced one error on line - console.log('executed');. I removed this line and it stopped at the JSON below.
var f = JSON.stringify({
's': values, 'da': $('input[name=Days]').val(), 'date': $('#date').val(),
'tv': $('#tv').html(), 'classCode': $('#ClassCodeValue').html(), 'section': $('#Sec').html(),
'we': $('#We').html(), 'attendType': $('#AttendTypeValue').html(),
'adClass': $('#adClass').val(),
'variousLen': variousLen,
'varDHour': varDHour,
'varDMin': varDMin
});
It is all working fine on development machine Windows 7 Professional.
I have given access to script folder and it looks like, jquery is working as it reach to this page on the website. but some of script or css not working properly as above issues.
Please suggest me what is wrong here.
I have been usin: IE 8 and IE 11.
It was weired issue. Actually, when i open hosted site on IE then site's mode is automatically set to compatibiity mode instead of standard mode. when i set its mode manually to standard mode then no such issue.
i have added expliciltiy : as firlst line of HEAD element.
Now, it works fine.. but it sets compaibitly view mode though most of the all issues are resolved.
but some issue arise for jqgrid header CSS. if set standard mode then it works fine.
If there is any way/suggestion to set on standard mode then it is best...exa- if browse has - IE9, IE9 comaptbility mode then above meta tag sets its mode to highest mode of that browser that goes to compabitlity mode.
I am using itranet application.
Thanks
I am getting script error in loading some web sites.
Please help me how to prevent script error in C# WebBrowser.
This is my code:
try
{
webBrowser1.Navigate(textBox1.Text);
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
MessageBox.Show("Loaded");
}
catch(Exception)
{
MessageBox.Show("failed");
}
Write this in Your Code
webBrowser1.ScriptErrorsSuppressed = true;
To disable the script error pop up, you need to go to (in Internet Explorer) Tools->Internet Options, there go to the Advanced tab, and in Browsing select Disable Script Debugging (Other), but, the problem may be related to the fact that every site loaded in the WebBrowser control is rendered in IE7 compatibility mode, to solve this the only thing you can do is a registry hack like this: WebBrowser control to use IE9
change your registry to 2af8 which is IE 11 for devenv.exe
software/Microsoft/internet explorer/main/featurecontrol/feature_Browser_emulation
If your working with a GUI (like in Visual Studio) just go to the Webbrowser Properties and set "ScriptErrorsSuppressed" = true
It is easy to see how this error has been eliminated. But Visual Studio uses Internet Explorer and another Web Browser coding is hard. If you look at the versions, the last Visual Studio one uses IE 11 for WebBrowser tool.
The C++ GUI is recommended for one of each encoding:
https://msdn.microsoft.com/en-us/library/60k1461a.aspx