Protractor with Firefox (32 latest) browser not loading - javascript

So for some reason, when I run protractor, Firefox (32 latest) just opens with an empty browser and doesn't navigate to the baseURL. The tests I have written work fine with chrome, but not with firefox. It probably has something to do with the way the conf file is set up. Any ideas?
Conf file:
exports.config = {
allScriptsTimeout: 11000,
specs: [
'e2e/*.js'
],
multiCapabilities: [
{
'browserName': 'firefox'
},
{
'browserName': 'chrome'
}
],
chromeOnly: false,
chromeDriver: 'e2e/chromedriver/',
baseUrl: 'http://localhost:9000/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};

Firefox 32 is broken with selenium <= 2.42.2
UPDATE Selenium 2.43 is out!
Need selenium 2.43 or newer version. Or downgrade Firefox back to version 31 or less.
Issue: https://code.google.com/p/selenium/issues/detail?id=7642
FYI output might look like this:
Using the selenium server at: http://localhost:4444/wd/hub
/home/username/e2e/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109
var template = new Error(this.message);
^
UnknownError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
003407891246748webdriver-profile/extensions/fxdriver#googlecode.com
1409877425492 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: /tmp/anonymous7362003407891246748webdriver-profile/extensions/webdriver-staging
1409877425492 addons.xpi DEBUG checkForChanges
1409877425502 addons.xpi DEBUG Directory state JSON differs:........

Related

Running protractor test in chrome driver doest not opens up any website

System Details
Mac OS, Chromedriver v=83.0.4103.39 , Protractor=7.0
My test is failing all the time when chromedriver opens any website it says your connection is not private please let me know how to fix this issue
chromedriver page
My spec.js looks like below
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');
});
});
config.js looks like below
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
};
this is how my proxies look like
proxy settings in mac
Changes my config.js to
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec1.js'],
//acceptInsecureCerts : true
'args': ['--disable-web-security', '--user-data-dir=~/.e2e-chrome-profile', '--ignore-certificate-errors']
};
Still any URL like facebook.com or google.com I am getting err_invalid_cert err

Nightwatch can't launch chromium after upgrading to Ubuntu 19.10

My Nightwatch test suite was running just fine until I upgraded Ubuntu to 19.10. Now, when the browser launches from the test script I get an error message:
Failed to load extension from: . Manifest file is missing or unreadable
The Ubuntu install upgraded Chromium to 78.0.3904.70, and also switched to the snap version. I don't know which of these changes has caused the symptom I'm seeing.
I've upgraded chromedriver to match the same version as Chromium.
Chromium itself launches just fine as a browser, so the other solutions I've seen as search results, finding and deleting existing Chrome profiles, etc, I don't want to do. Ideally I'd like the browser that my nightwatch tests launch to be independent of any existing user profiles.
For reference, my Nightwatch config is:
// eslint-disable-next-line camelcase
const selenium_port = process.env.SELENIUM_PORT || 4444
const chromeArgs = process.env.SHOW_BROWSER ? [] : ['headless']
const driver = process.env.CHROMEDRIVER
module.exports = {
page_objects_path: './tests/e2e/page-objects',
test_settings: {
default: {
globals: {
waitForConditionTimeout: 5000
},
selenium_port,
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
args: chromeArgs
}
},
webdriver: {
server_path: driver
}
}
},
'selenium': {
'port': selenium_port
}
}

appium-uiautomator2-server-v0.1.8.apk' exited with code 1" while getting badging info

I am trying to learn Appium, using the instructions given in the documentation:
http://appium.io/docs/en/about-appium/getting-started/?lang=en
I have put this code into a file called AppiumTest.js
const wdio = require('webdriverio');
const opts = {
port: 4723,
desiredCapabilities: {
platformName: "Android",
platformVersion: "8.0",
deviceName: "Pixel_API_26",
app: "C:/Users/SStaple/AppData/Local/Android/Sdk/ApiDemos-debug.apk",
automationName: "UiAutomator2"
}
};
const client = wdio.remote(opts);
client
.init()
.click("~App")
.click("~Alert Dialogs")
.back()
.back()
.end();
I am running it from the Node.js command prompt, using the command: node AppiumTest.js, after starting the Appium Server. It was also necessary to have an Android 8 emulator running.
(Appium Server v1.7.1)
I am getting an output in the Appium Server window. There are a number of errors. The first error shown is this:
Error "Command 'C\:\\Users\\SStaple\\AppData\\Local\\Android\\Sdk\\build-tools\\26.0.2\\aapt.exe d badging C\:\\Users\\SStaple\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-driver\\uiautomator2\\appium-uiautomator2-server-v0.1.8.apk' exited with code 1" while getting badging info
I have tried running this command on its own in the Command Prompt:
C:\Users\SStaple\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt.exe d badging C:\Users\SStaple\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\uiautomator2\appium-uiautomator2-server-v0.1.8.apk
The result I get here is this:
W/zipro (13656): Error opening archive C:\Users\SStaple\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\uiautomator2\appium-uiautomator2-server-v0.1.8.apk: Invalid file
ERROR: dump failed because no AndroidManifest.xml found
Any ideas?
Update 28/12/2017 - I found the solution!
The file in question looked suspect. It was 0Kb in size!
I downloaded the apk file from https://github.com/appium/appium-uiautomator2-server/releases and used that instead.
This one is 1,518 KB in size.
(Apparently there is some problem with npm not putting that apk file into the right place while beta is installed.)
Having fixed that, I can move on to the next problem!
Its a known issue with apk signing.
You can start with trying to update dependencies:
npm install appium-uiautomator2-driver
npm install appium-adb
If it didn't help, there is more you can try (but that was for Linux):
modify
./node-v6.11.4-linux-armv7l/lib/node_modules/appium/node_modules/appium-adb/build/lib/tools/apk-signing.js so it would return a true even if it looks not signed.
case 20:
context$1$0.prev = 20;
context$1$0.t0 = context$1$0’catch’;
_loggerJs2[‘default’].debug(“App not signed with debug cert.”);
return context$1$0.abrupt(‘return’, true);

Run Selenium (v3.4.0) tests on older versions of Firefox (v41.0)

after some lost hours browsing internet, I'm not able to find the solution. I'm currently trying to test my app on older versions of Firefox (here, v41.0) for some reasons. I'm passing by a docker image of Selenium for the hub (v3.4.0) and a docker image for the Firefox node (v41.0).
I know that for older versions of Firefox, Geckodriver, isn't compatible but it seems having a solution using
{ "marionette": true }
The Firefox node is perfectly connecting to the grid. I can connect to it using docker exec -it <container-id> bash but the issue appears while running the test.
I'm still trying to find it but I'm blocked. Here the code of the Dockerfile: hub.docker.com/r/selenium/node-firefox/~/dockerfile/ for the Firefox node and here is the code for the test (using MochaJS).
test.it("should redirect to Google with FIREFOX 41.0", () => {
var firefoxCap = Capabilities.firefox();
firefoxCap.set('marionette', true);
driver = new webdriver.Builder()
.usingServer(CONSTANTS.SELENIUM_HUB)
.withCapabilities(firefoxCap)
.build();
driver.get(CONSTANTS.GOOGLE_URL);
driver.wait(until.titleIs(CONSTANTS.GOOGLE_TITLE));
driver.wait(until.elementLocated(By.name(CONSTANTS.GOOGLE_SEARCH_KEY))).sendKeys(CONSTANTS.GOOGLE_SEARCH_VALUE);
driver.findElement(By.name(CONSTANTS.GOOGLE_SEARCH_BUTTON_NAME)).click();
driver.wait(until.titleIs(CONSTANTS.GOOGLE_SEARCH_TITLE));
driver.wait(until.elementLocated(By.tagName(CONSTANTS.GOOGLE_RES_LINK))).click();
driver.wait(until.titleIs(CONSTANTS.GOOGLE_TITLE));
driver.quit();
});
Here the logs
~/dev/selenium-grids/src$ mocha --timeout 30000 tests.js
Starting the tests...
Work with REMOTE URL
1) should redirect to Google with FIREFOX 41.0
0 passing (6s)
1 failing
1) Work with REMOTE URL should redirect to Google with FIREFOX 41.0:
WebDriverError: Missing 'marionetteProtocol' field in handshake
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'd4b3266d29f4', ip: '172.17.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-87-generic', java.version: '1.8.0_131'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
0: 0x5787ed - backtrace::backtrace::trace::h59229d13f6a8837d
1: 0x578942 - backtrace::capture::Backtrace::new::h23089c033eded8f0
2: 0x450aec - geckodriver::marionette::MarionetteHandler::create_connection::h6f7058fccafe4367
3: 0x425c32 - <webdriver::server::Dispatcher<T, U>>::run::h8f5348b8f5f7c053
4: 0x40b22c - std::panicking::try::do_call::hb67c6fb6bcd96195
5: 0x5dc20a - panic_unwind::__rust_maybe_catch_panic
at /checkout/src/libpanic_unwind/lib.rs:98
6: 0x41b943 - <F as alloc::boxed::FnBox<A>>::call_box::h4100941edc372034
7: 0x5d48a4 - alloc::boxed::{{impl}}::call_once<(),()>
at /checkout/src/liballoc/boxed.rs:650
- std::sys_common::thread::start_thread
at /checkout/src/libstd/sys_common/thread.rs:21
- std::sys::imp::thread::{{impl}}::new::thread_start
at /checkout/src/libstd/sys/unix/thread.rs:84
at Object.checkLegacyResponse (node_modules/selenium-webdriver/lib/error.js:517:15)
at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:169:7)
From: Task: WebDriver.createSession()
at Function.createSession (node_modules/selenium-webdriver/lib/webdriver.js:777:24)
at Function.createSession (node_modules/selenium-webdriver/firefox/index.js:667:55)
at createDriver (node_modules/selenium-webdriver/index.js:167:33)
at Builder.build (node_modules/selenium-webdriver/index.js:629:16)
at Context.test.it (tests_web.js:64:14)
at runTest (node_modules/selenium-webdriver/testing/index.js:164:22)
at node_modules/selenium-webdriver/testing/index.js:185:16
at new ManagedPromise (node_modules/selenium-webdriver/lib/promise.js:1085:7)
at controlFlowExecute (node_modules/selenium-webdriver/testing/index.js:184:14)
at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:3092:14)
at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:3075:27)
at asyncRun (node_modules/selenium-webdriver/lib/promise.js:2982:25)
at node_modules/selenium-webdriver/lib/promise.js:676:7
at <anonymous>
From: Task: Work with REMOTE URL should redirect to Google with FIREFOX 41.0
at Context.ret (node_modules/selenium-webdriver/testing/index.js:183:10)
Closing the tests
When googling the issue because "Google is your friend", the only responses are "Update your Firefox versions" or "Downgrade your Selenium version" but I can't. Can someone explain me how to make it work? Even a workaround would be accepted.
Thanks
While you work with Selenium 3.4.0 with Mozilla Firefox 41.0 you need to downgrade your geckodriver to either version v0.17.0 or v0.16.1 or v0.16.0.
The following were the last announced dependency:
geckodriver v0.18.0 now recommends Firefox 53 and greater
geckodriver v0.16.0 is only compatible with Selenium 3.4 and greater
Finally, assuming the geckodriver.exe absolute path is within your System/User Path you have to explicitly set the marionette property to false (mandatory)
Your code block will be looking like:
test.it("should redirect to Google with FIREFOX 41.0", () => {
var firefoxCap = Capabilities.firefox();
firefoxCap.set('marionette', false);
driver = new webdriver.Builder()
.usingServer(CONSTANTS.SELENIUM_HUB)
.withCapabilities(firefoxCap)
.build();
Java Code to open legacy Mozilla Firefox 47.0.1 (geckodriver v0.16.1) :
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class Opening_FIREFOX_legacy
{
public static void main(String[] args)
{
System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver-v0.16.1-win64\\geckodriver.exe");
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability("firefox_binary", "C:\\Program Files\\Mozilla Firefox47\\firefox.exe");
dc.setCapability("marionette", false);
WebDriver driver = new FirefoxDriver(dc);
driver.manage().window().maximize();
driver.get("https://google.com");
}
}
Python Code to open legacy Mozilla Firefox 47.0.1 (geckodriver v0.18.0) :
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
binary = FirefoxBinary(r'C:\Program Files\Mozilla Firefox47\firefox.exe')
caps = DesiredCapabilities().FIREFOX
caps["marionette"] = False
driver = webdriver.Firefox(capabilities=caps, firefox_binary=binary, executable_path="C:\\Utility\\BrowserDrivers\\geckodriver.exe")
driver.get('https://stackoverflow.com')

Safari WebDriver setTimeout using protractor exiting

I have done a lot of unit tests using Karma, but my office would like to have some integration tests, especially testing cross browser capabilities. For this, it seemed Protractor was my best option, and I have started get get some basic dashboard tests going, but am stuck with safari.
My Config:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['scenarios/*Scenario.js'],
framework: 'jasmine',
baseUrl: 'https://www-dev.remeeting.com/',
multiCapabilities: [{
browserName: 'firefox'
}, {
browserName: 'chrome'
}, {
browserName: 'safari'
}],
onPrepare: function() {
browser.driver.get('https://www-dev.remeeting.com/');
browser.driver.findElement(by.id('email')).sendKeys('adam+test#mod9.com');
browser.driver.findElement(by.id('password')).sendKeys('abc123');
browser.driver.findElement(by.id('submit_btn')).click();
// Login takes some time, so wait until it's done.
// For the test app's login, we know it's done when it redirects to
// app/#/d.
return browser.driver.wait(function() {
return browser.driver.getCurrentUrl().then(function(url) {
return /app\/#\/d/.test(url);
});
}, 10000);
}
};
My only spec
describe('Dashboard', function() {
it('should login to the dashboard', function() {
expect(element(by.css('.dashboard')).getText()).toMatch(/Upload Meeting/);
expect(element(by.id('refreshButton')));
expect(element(by.css('.dashboard div.btn-group')))
});
});
And the error
[safari #21] PID: 79079
[safari #21] Specs: /Users/adam/git/mrp- www/e2e/scenarios/dashboardScenario.js
[safari #21]
[safari #21] Using the selenium server at http://localhost:4444/wd/hub
[safari #21] ERROR - Unable to start a WebDriver session.
[safari #21] Unknown command: setTimeout (WARNING: The server did not provide any stacktrace information)
...
[safari #21] Driver info: org.openqa.selenium.safari.SafariDriver
[safari #21] Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=9.1, cssSelectorsEnabled=true, platform=MAC, secureSsl=true}]
[safari #21] Session ID: null
[launcher] Runner process exited unexpectedly with error code: 1
[launcher] 2 instance(s) of WebDriver still running
Anybody know how to configure protractor for safari?
Here is what I did to successfully set up Safari + Protractor:
made sure I have the latest Safari (9.1 at the moment)
downloaded the latest Safari driver from this page, opened the Safari extensions preferences and dragged and dropped the SafariDriver.safariextz file into the extension list:
upgraded protractor to the latest version (3.2.2 at the moment)
Note that, as an alternative, you can always run Safari remotely on BrowserStack or SauceLabs.
See also the list of Safari+Protractor issues.

Categories

Resources