Troubleshooting PhantomJS hanging with WebdriverJS tests on Windows

I am currently using webdriverjs to run automated tests on a Windows 8 system. The tests run successfully when the browser is set to Chrome, but encounter issues when I switch to PhantomJS. Interestingly, the same tests run smoothly on OS X Mavericks.

Instead of failing, the tests seem to wait indefinitely without any progress.

This is where the client is defined in the file:

exports.client = require('webdriverjs').remote({
  desiredCapabilities: {
    browserName: 'phantomjs'
  }
});

Furthermore, this file contains my test script:

var chai        = require('chai'),
    assert      = chai.assert,
    expect      = chai.expect,
    webdriverjs = require('webdriverjs'),
    client      = require('./client').client;

describe('my webdriverjs tests', function(){

  this.timeout(10000);

  before(function(done){
    client.init(done);
  });

  it('Github test',function(done) {
    client
      .url('https://github.com/')
      .getElementSize('.header-logo-wordmark', function(err, result) {
        assert.equal(null, err);
        assert.strictEqual(result.height , 32);
        assert.strictEqual(result.width, 89);
      })
      .getTitle(function(err, title) {
        assert.equal(null, err);
        assert.strictEqual(title,'GitHub · Build software better, together.');
      })
      .getCssProperty('a[href="/plans"]', 'color', function(err, result){
        assert.equal(null, err);
        assert.strictEqual(result, 'rgba(65,131,196,1)');
      })
      .call(done);
  });

  after(function(done) {
    client.end(done);
  });
});

I have installed mocha, selenium-standalone, phantomjs NPM packages globally, and webdriverjs as well as chai in the project directory.

To start selenium, I use the start-selenium command, and then execute the test with mocha test.js.

Despite not encountering any failures, the test just hangs with a blinking cursor until I manually stop it.

Here is the output from selenium:

c:\Code\cie-teacher-support-portal-web\src\CIE.TeacherSupportPortal.Web>start-selenium
Jun 10, 2014 10:33:18 AM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
Setting system property webdriver.chrome.driver to C:\Users\Alex Cason\AppData\Roaming\npm\node_modules\selenium-standalone\.selenium\2.42.0\chromedriver
10:33:18.788 INFO - Java: Oracle Corporation 21.0-b17
10:33:18.789 INFO - OS: Windows NT (unknown) 6.2 amd64
10:33:18.820 INFO - v2.42.0, with Core v2.42.0. Built from revision 5e82430
10:33:18.935 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
... (output continues)

Answer №1

To use Ghostdriver, it must be registered with the Selenium server:

(1) Begin by starting the Selenium server as a hub:

java -jar selenium-server-standalone-2.42.2.jar -role hub

(2) Then start phantomjs/ghostdriver and connect it to the selenium server:

phantomjs --webdriver=4445 --webdriver-selenium-grid-hub=http://127.0.0.1:4444

An issue in webdriverjs currently prevents direct use of phantomjs without the Selenium server.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Centered on the screen are the input field and corresponding label

I am in the process of creating a signup form, and I have encountered an issue. How can I make the input wider without using a fixed width like width: 420px? Additionally, I would like to center both the input field and the label. I envision something simi ...

The argument 'TabsCtrl1' is throwing an error as it is not recognized as a valid function and is showing as

I have encountered a problem with my controller, and I am seeing the following error message: Error: [ng:areq] Argument 'TabsCtrl1' is not a function, got undefined http://errors.angularjs.org/1.3.0-beta.11/ng/areq?p0=TabsCtrl1&p1=not%20a%20 ...

Assigning values to template variables in Express 4's routes/index

Recently, I started using node.js and express. To set up express 4, I used the command "express myAppName" in the terminal, which created a default directory with Jade templates as default. The main file, app.js, has the following standard express boilerp ...

Angular 8 combined with Mmenu light JS

Looking for guidance on integrating the Mmenu light JS plugin into an Angular 8 project. Wondering where to incorporate the 'mmenu-light.js' code. Any insights or advice would be greatly appreciated. Thank you! ...

Checking for a particular element's existence in an array using jQuery

Is there a way to verify the presence of the var element in the array sites? var sites = array['test','about','try']; var element = 'other'; ...

Multer is successfully retrieving images, but unfortunately, it is failing to save the files in the intended directory

I am currently facing an issue with my Express server. The problem arises when a user attempts to make a post request for their profile, including a profile picture submission. I have set up Multer to handle the image upload process and store the photo in ...

Having trouble with your custom AngularJS directive not functioning correctly?

I am facing an issue with my custom directive implementation. I have a custom directive that contains a table which references a controller. The ProjectController part works fine when it is not included in the code, but as soon as I put everything into the ...

Add a preventDefault event listener to a submit button that triggers a specific function

$(function() { $('#login').submit(function(e){ preventSubmission(); e.preventDefault(); }); }); function preventSubmission() { $('#btnLogin').attr('disabled','disabled'); $("#btnLogi ...

What steps can be taken to guarantee that React updates occur in the correct order?

I'm currently working on developing a multi-select dropdown and facing the issue of hiding the options once a user selects one. The problem arises when I try to update the selectedCategoriesData state and then hide the dropdown using setShowCategories ...

Extracting date information from an HTML table for use in Highcharts

Trying to utilize HighCharts' HTML-table-to-chart script for generating a line graph from a table. Desiring to set a datetime x-axis, so the following steps have been taken: Utilizing Date.parse(this.innerHTML) to convert row headers into date stri ...

Adjusting the background element of a fullpage.js layout during resizing and customization

Is there a way to make the background image responsive on a fullpage.js page, specifically for mobile and tablet devices? How can I ensure that a specific part of the image stays at the center of the page when resizing? For instance, in the provided imag ...

An algorithm designed to identify matching song lyrics based on a keyword or its fragments

I am currently dealing with a large text file consisting of over 852000 lines, each containing song verses preceded by different numbers like 1., 134-20., or 1231.. The verses may have four or more lines. Additionally, there are variations within the lines ...

What exactly is the purpose of editing a host file?

After reviewing this repository, an automatic message pops up: Don't forget to modify your host file 127.0.0.1 * http://localhost:3001 What exactly does that entail? ...

The Bootstrap validator triggers the form submission only after the second click

When I click on the submit button, I am attempting to submit a form that has its default action prevented and first checks a condition before proceeding. Below is the code snippet: $('#payment-form').bootstrapValidator({ live: 'dis ...

Tips for generating a dynamic Array name to be sorted with React JS

My lack of experience is causing some issues for me. I am currently working on a form in react where the user has to select two values first. Based on these two values, a third value will be available for selection. However, the options for this third val ...

In search of a React.js/Redux OpenID library or example, particularly focused on Steam OpenID integration

Currently, I am developing a Node/Express REST + React/Redux application that requires Steam OpenID for authentication. Despite searching extensively for tutorials, libraries, or example code related to Steam OpenID (or any other OpenID), I have come up em ...

Issues with AngularJS Directives not functioning properly when elements are added dynamically through an AJAX request

I am facing a scenario where I have a page featuring a modal window that is created using the AngularUI Bootstrap modal directive. The DOM structure for this modal is being dynamically loaded from the server, and it is triggered to open when a specific but ...

Having difficulty locating the login button on the webpage

I am attempting to log into a banking account using selenuim. After opening the webpage and locating the login element, I initially struggled to access it by its "name" or "id." Fortunately, I was able to successfully access it using driver.find_element_by ...

Unpredictable jQuery Ajax setTimeout

I have a script that retrieves data from ajax.php and displays it in a div. The intention is for the information to be shown for a period of 3 seconds before hiding the #ajax-content and displaying #welcome-content. Most of the time it works as intended, ...

When attempting to add an item to an array within a sub-document using Mongoose and MongoDB, the error message "Property 'messages' not found" is returned

I am working with four different models: teacher, student, teacherMessageSchema, and studentMessageSchema. The teacherMessageSchema is a subdocument within the 'teacher' model under the messages: [teacherMessageSchema] property, while the student ...