Selenium WebDriverJs has difficulty in setting up a new client for iOS devices

Struggling to make Selenium WebDriverJS work with the iOS browser, but unfortunately facing some issues.

I followed the instructions on setting up the "iWebDriver" project as mentioned on the iPhoneDriver wiki page. The Python script worked fine, and even a small nodeJS project ran smoothly. However, when attempting to run it from the browser, Firefox displayed the following error message:

Error: Unable to create a new client for this browser. The WebDriver session ID has not been defined.

Here is the code I'm trying to execute:

var driver = new webdriver.Builder().
    usingServer('http://localhost:3001/wd/hub').
    withCapabilities({'browserName': 'iPhone'}).
    build();

driver.get('http://www.google.com');
driver.quit();

I have compiled webdriverjs as instructed on the WebDriverJs wiki page. And yes, webdriver.js is indeed loaded ;)

Answer №1

After some digging, I have come up with a solution that seems a bit unconventional but it is working smoothly for my Firefox extension.

I made adjustments to the webdriver.js file's

webdriver.Builder.prototype.build
method like this:

webdriver.Builder.prototype.build = function() {
  var a;
//  if(webdriver.FirefoxDomExecutor.isAvailable()) {
//    return a = new webdriver.FirefoxDomExecutor, webdriver.WebDriver.createSession(a, this.getCapabilities())
//  }
  a = new webdriver.http.CorsClient(this.getServerUrl());
  a = new webdriver.http.Executor(a);
//  if(this.getSession()) {
//    return webdriver.WebDriver.attachToSession(a, this.getSession())
//  }
//  throw Error("Unable to create a new client for this browser. The WebDriver session ID has not been defined.");
  return webdriver.WebDriver.createSession(a, this.getCapabilities());
};

In essence, I am enforcing the creation of a session and bypassing the necessity for FirefoxDomExecutor, as my customized changes seem to be functioning properly on both Firefox and Chrome. I appreciate the guidance that pointed me in the right direction, and hopefully, this adjustment will be beneficial to others facing similar challenges.

Answer №2

WebDriverJS may face limitations in initiating a new Session outside of a Node.js environment.

To work around this, you will need to manually create a Session and pass the session-id to WebDriverJS as the wdsid GET-Parameter (for example,

urltowebdriver.html?wdsid=someID&wdurl=localhost:9000
).

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

What is the process of utilizing marked plugins within a Vue3 project?

I attempted to integrate the marked plugin into my Vue.js applications. After installing [email protected], I did not encounter any issues during compilation. However, when I viewed the contents in the browser, nothing appeared. My Vue project was built u ...

The position of a jQuery element gets reset when both the show and stop animations are used

When I use jQuery's .position() to place an element, everything works fine. But as soon as I display an animation and then cancel it with an ajax call, the position of the element resets. function displayMessage(msg) { var $messageEl = $('#u ...

Effective ways to properly designate a variable inside a block?

I have a unique method for parsing HTML using a WKWebView: - (NSString *)stringByEvaluatingJavascript:(NSString *)javascript { NSString *output = @""; [self.webView evaluateJavaScript:javascript completionHandler:^(id result, NSErr ...

Every time I click once, two unnecessary AJAX calls are triggered, and the DOM remains outdated until I manually refresh the page

Whenever I click on a span, it sends an ajax request to delete the clicked todo from the database. However, in the DOM, the item is not removed until I refresh the page. Here is my index.html file: <ul class="list"> </ul> I noticed ...

Tips for passing a function and an object to a functional component in React

I am struggling with TypeScript and React, so please provide clear instructions. Thank you in advance for your help! My current challenge involves passing both a function and an object to a component. Let's take a look at my component called WordIte ...

Steps for creating interconnected datepickers in jQuery with month and year selection:To create a dependent datepicker with month and year selection using

The JSFiddle I currently have is not functioning as expected. When the user directly selects the end-date, it does not restrict the start-date in this particular fiddle. It should change once the user directly changes the end-date. The functionality works ...

How can I create a customized scrollbar for a div element in an Angular 2.0 CLI project?

I am attempting to create a sleek horizontal scroll bar within one of my div elements, similar to the example shown here: https://i.stack.imgur.com/ziWhi.png My project is based on the angular2 CLI. Progress so far: I came across this package angular2-s ...

Tips for sending data scraped from a website using Express

I have created a web crawler using Axios and am attempting to upload a file through Express. I currently have 10 different crawlers running with corresponding HTML form methods in Express. However, when I click the button, it downloads a blank file first ...

Oops! It seems like you've stumbled upon a 404 error on Django

I need to retrieve the price value immediately after a product is selected in the sale form. The sale form includes fields for price, quantity, and product. Once a user selects a product, the price of that product should populate the input box for price. T ...

Verify if the term is present in an external JSON file

I am currently using tag-it to allow users to create tags for their posts. At the moment, users can type any word, but I have a list of prohibited words stored in JSON format. I am looking for a way to integrate this list into the tagit plugin so that if ...

Encountering difficulty with installing Node 10.x version inside a docker container

I already have the necessary code to install nodejs 10.x version within an ubuntu docker file. However, I am encountering an issue where only the old version is being displayed when I use the command node -v instead of the latest one. Below is the dockerfi ...

Is there a way to pull information from a string and organize it into a two-dimensional array?

Utilizing the axios library, I am pulling data from a website. Unfortunately, the data being fetched is in HTML format. The extracted data looks like this: 1 Agartala VEAT 120830Z 23004KT 5000 HZ SCT018 SCT025 34/27 Q1004 NOSIG= 2 Ahmedabad VAAH 120830Z 23 ...

PHP Dropdown List - Default option should be set to "all" (or "Alle")

My website displays data to users based on the State they reside in, with a filter provided through a drop-down list allowing them to select any specific State or view data from all States. Currently, the default selection shows the user data from their ow ...

Guide to sending and receiving JSON data using XAMPP PHP

Currently, my XAMPP 7.1.10-0 server is up and running with the following index.php file: <?php if(isset($_POST["username"])) { echo $_POST; header("Location:getbooks.php"); exit; } else { echo file_get_conten ...

Selenium and Python error: Element obstructs keyboard access

I have been struggling for almost a month now while trying to automatically fill in a form with Selenium. I recorded a script, but I am facing an issue with the zip code field, which triggers a new window for javascript autofill suggestions. My goal is to ...

guide on creating a simple line highchart using JSON data

Here is the JSON data I have: {"09/02/2014 15:36:25":[33.82,33.42,40.83],"08/11/2014 16:25:15":[36.6,33.42,40.45],"07/30/2014 08:43:57":[0.0,0.0,0.0],"08/12/2014 22:00:52":[77.99,74.1,80.12],"08/12/2014 21:19:48":[56.91,63.23,52.42],"07/23/2014 13:37:46": ...

Selenium: Issue with sending messages on WhatsApp through the path is not functioning

Yesterday, I attempted to create a code for sending messages via WhatsApp. However, no matter how many different approaches I tried to insert the message into the chat box, I kept encountering the same error message: "unknown error: call function result mi ...

Tips for broadcasting a router event

Currently, I am working with 2 modules - one being the sidenav module where I can select menus and the other is the content module which contains a router-outlet. I am looking for the best way to display components in the content module based on menu selec ...

An issue related to AngularJS and the injection of ui-bootstrap components has been encountered

I'm encountering an issue with injection errors in my code, and unfortunately, the debugger in Firefox isn't providing much help. Here are snippets of the code: This is the Controller file causing the error: App.controller('ModalInstanceCt ...

Establishing a dynamic database feature (such as a real-time leader board) on a website

Recently, I designed a fun JavaScript game for my website and now I am contemplating adding a leaderboard feature. However, I am unsure about which type of database would be the best fit - MongoDB, SQLite, or something else entirely. I have heard that SQ ...