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

Executing a function in ExpressJS at regular intervals of 24 hours

Can someone share the most effective method to schedule an automated task every 24 hours in ExpressJS? I have thoroughly researched possible solutions but haven't found any option other than using an infinite loop. Is there only one way to achieve th ...

Enhance the appearance of the <td> <span> element by incorporating a transition effect when modifying the text

I need help with creating a transition effect for a span element within a table cell. Currently, when a user clicks on the text, it changes from truncated to full size abruptly. I want to achieve a smooth growing/scaling effect instead. You can view an exa ...

A React component that exclusively renders component tags

After successfully loading index.html with no JavaScript errors, I ran into an issue where nothing was rendering on the page. Upon inspecting the webpage, all I could see was a tag and nothing else. It turns out that I have a component called "list". The ...

Search for data in Mongoose by utilizing a query object that has been obtained from a query string

After extracting and parsing a querystring from a URL, I am able to map it into an object structure like this: { '$and': [ { length: { '$gt': '2' } }, { length: { '$lt': '55555' } } ] } This object is st ...

What is the best way to ensure a DOM element exists before you can start manipulating it?

In my AngularJS application, I am utilizing Angular Material and md-select. When a user clicks on the md-select, a dropdown list appears and an overlay with the tag Name is added to the DOM. My goal is to add a class or style as soon as the user clicks on ...

Fetching server-side data for isomorphic React app: A guide to accessing cookies

Currently, I am in the process of developing an isomorphic/universal React + Redux + Express application. The method I use for server-side data fetching is quite standard: I identify the routes that match the URL, call the appropriate data-fetching functio ...

Establish height and width parameters for creating a dynamic and adaptable bar chart with recharts

I am currently facing an issue with recharts while trying to implement a BarChart. The setting width={600} and height={300} is causing the Barchart to be fixed in size, rather than responsive. How can I make the BarChart responsive? I attempted using per ...

Attempting to cycle through rows of a table and triggering setInterval for each row does not appear to be successful

I am attempting to change the value of a cell from Offline to Online (and vice versa) within my DataTable by utilizing a web service. var $myTable = $("#my-table").dataTable(); var $myTableRows = $myTable.fnGetNodes(); for(var i=0; i<$myTableRows.leng ...

Differentiating categories in the second parameter for controller method in AngularJS?

As a newcomer to Angular, I have noticed that the locals argument in the controller function can sometimes be just a function and other times an array. angular.module('contentful').controller( 'FormWidgetsController', ['$s ...

What could be causing Next.js middleware to run repeatedly?

Recently, I set up a brand new Next.js project using npx create-next-app@latest --typescript. Upon completing the installation (version 13.3.4), without making any modifications to existing files, I introduced a new file named middleware.ts within the src ...

Using scrollIntoView() in combination with Angular Material's Mat-Menu-Item does not produce the desired result

I am facing an issue with angular material and scrollIntoView({ behavior: 'smooth', block: 'start' }). My goal is to click on a mat-menu-item, which is inside an item in a mat-table, and scroll to a specific HTML tag This is my target ...

Is there a way to switch an element across various pages within Ionic 3?

Is it possible to exchange information between two pages using logic? I have successfully implemented a checklist, but I am unsure how to add a success/error icon next to the Room name on the 'verifyplace.html' page after invoking the goToNextPa ...

unable to display images from a folder using v-for in Vue.js

Just getting started with Vuejs and I have two pictures stored on my website. The v-for loop is correctly populating the information inside databaseListItem. The path is /opt/lampp/htdocs/products_db/stored_images/cms.png https://i.stack.imgur.com/969U7.p ...

Ways to resolve the issue of the experimental syntax 'jsx' not being enabled

I encountered an issue while trying to implement react-fancybox and received an error. https://i.sstatic.net/vgFha.png To resolve the error, I executed the following commands: npm install --save-dev @babel/preset-react, npm install --save-dev @babel/plugi ...

identify when the React component has reached the bottom of the element by reading the

Is there a way to access the scroll handler's event without being able to access offsetTop, scrollTop, etc? class App extends React.Component { handleScroll = e => { console.log(e.target.scrollTop); }; componentDidMo ...

How can I transfer the data from a file to upload it in Angular 9 without manually typing it out?

In my Angular application, I have a functionality where users can upload two files for processing on the server. However, I am looking to add a feature that allows users to simply copy and paste the contents of the files into two textboxes instead of going ...

How to create a floating <Toolbar/> with ReactJS, Redux, and Material-UI

Can anyone help me figure out how to make a toolbar floatable when scrolling down using Material-UI? I tried setting textAlign:'center', position: 'fixed', top: 0, but it's resizing strangely when applied to the <Toolbar/>. ...

How to return a variable to Express when clicking a button?

Imagine having a list of 10 elements, each with a unique id as their name, and the user has the ability to add more items to the list at any time. If I were to click on an element, my goal is to have Express retrieve the id of that specific element. If it ...

Discover the power of using CSS selectors nth-of-type and nth-child to find specific elements in Python Selenium automation

Here is an example of a page structure: <class id="class1"> <ul> <li> <strong>section 1</strong> <a href="link.com/home1">some link 1</a> <li> <strong>sec ...

Obtaining asynchronous data with nodejs is possible through several methods

I am currently trying to retrieve data from a MySQL table using Node.js. I have a SQL routine in another Node.js file that I am calling, but I am struggling to get the callback function to return the data. I suspect that the issue may be related to calling ...