Update settings when starting with chromedriver

I am currently using webdriver (), standalone selenium, and mocha for writing my test cases. These test cases are specifically designed for Chrome, so I rely on chromedriver for execution.

However, when launching the browser, I need to ensure that the "touch-events" and "touch-optimized-ui" flags are disabled to prevent any failures in my test cases.

By default, every time chromedriver initiates the browser, it uses default options. So, I am seeking a solution to disable those specific flags. Can anyone suggest what modifications can be made to the code below to achieve this? Or perhaps propose an alternative solution?

Here is a snippet of the sample code:

var webdriverjs = require('./webdriverjs/index'),
    assert      = require('assert');

describe('My WebdriverJS Tests', function(){

    this.timeout(99999999);
    var client = {};

    before(function(done){
            client = webdriverjs.remote({ desiredCapabilities: {browserName: 'chrome'} });
            client.init(done);
    });

    it('Sample Test',function(done) {
        client
            .url('http://localhost:3030/subset/index')
            .call(done)
    });

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

Answer №1

To customize your WebDriver capabilities to include specific Chrome flags, use the following code snippet:

driver = webdriver.remote({
    desiredCapabilities: {
        browserName: 'chrome',
        chromeOptions: {
            args: ['touch-events','touch-optimized-ui']
        }
    }
});

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

Show the selected checkbox options upon clicking the submit button

Having trouble setting up a filter? I need to create a feature where checked values from checkboxes are displayed in a specific div after submitting. The display should include a 'Clear All' button and individual 'X' buttons to remove e ...

Transitioning from using a jQuery get request to utilizing Vue.js

Looking to transition from JQuery-based js to Vue as a newcomer to JavaScript. Seeking guidance on making a get request and displaying the retrieved data. What approach would you recommend for this task? Here's the HTML snippet: <div> <di ...

Exploring the combination of Express router, Auth0, and plain Javascript: A guide to implementing post-login authentication on a router

After creating a front end with vite using vanilla javascript and setting up a backend with node.js express routes, I successfully integrated swagger for testing purposes. I have managed to enable functionalities such as logging in, logging out, and securi ...

Unable to process JavaScript function

Still in the process of developing my "mvc/social" PHP project, I am currently focusing on securing user input for the status message. I have created both a PHP and JavaScript function for this purpose, but it seems like the JavaScript function is not bein ...

The Chrome extension for the New Tab Page is taking the spotlight away from the address bar

It appears that with the latest version of Chrome, extensions that previously had the ability to override Chrome's New Tab Page and take focus away from the Omnibox no longer have this capability. Is there a different method now to give focus to an i ...

Send a signal to a space, leveraging the distinct characteristics of each socket as input parameters

I am looking to send a function to a group of sockets, with each socket receiving the function along with a specific parameter unique to that particular socket. In my coding scenario, this distinctive variable represents the player's number. As socke ...

Leveraging jQuery plugins within an AngularJs application

I am currently trying to implement the tinyColorPicker plugin from here in my Angular app, but I am facing difficulties with it. An error message keeps appearing: TypeError: element.colorPicker is not a function In my index.html file, I have included th ...

Cease the use of bi-directional data binding on an Angular directive

One way I've been attempting to send information to a directive is through the following setup: <ui-message data="{{app}}"></ui-message> In my controller, this is how I define it: app.controller("testCtrl", function($scope) { $scope.a ...

Using the $.ajax function to make requests with CORS restrictions

Having some trouble with an AJAX request. I encountered the following error message: Error: Access is denied This is the jQuery AJAX request I attempted: $.support.cors = true; $.ajax({ url: 'http://testwebsite.com/test', type: "GET" ...

The rule 'react-hooks/exhaustive-deps' does not have a defined definition

I received an eslint error message after inserting // eslint-disable-next-line react-hooks/exhaustive-deps into my code. 8:14 error Rule 'react-hooks/exhaustive-deps' definition not found I tried to resolve this issue by referring to this p ...

Tips for implementing Regular Expression Validations with Selenium

I am working on a project that involves checking for special characters in a text box. Specifically, the text box should not accept around 10 different special characters. When invalid special characters are entered, a red asterisk * mark is displayed by t ...

To ascertain whether the mouse is still lingering over the menu

I have a condensed menu construction that unfortunately cannot be changed in HTML, only CSS and JS modifications are possible! $('span').on("hover", handleHover('span')); function handleHover(e) { $(e).on({ mouse ...

Encountering a problem while trying to install Cordova

Whenever I try to install Cordova using npm, an error message pops up: Error: No compatible version found: ripple-emulator@'>=0.9.15' I have already Node, Nodejs, and npm installed. Unfortunately, I couldn't find any solution online. ...

The gulp-pug plugin is malfunctioning and displaying an error message stating "unexpected token 'indent'"

There seems to be an issue with gulp-pug indicating an unexpected token "indent" Please refer to the images below for further details: gulp code and nodejs command prompt index.pug and nodejs command prompt package.json and nodejs command prompt I am ...

Implementing changes in the last loop iteration to impact the final result in Vue

Having recently delved into Vue, I'm having trouble figuring out how to solve this issue. Let me begin by showing you the code snippet followed by explaining the problem at hand. Currently, I am utilizing Vue-Good-Table for this project. methods:{ ...

Utilizing Mongodb for complex query conditions

I am new to using MongoDB and express for database interactions. My goal is to query the database based on URL parameters by extracting them from the URL and adding them to an object if they exist in order to use them when querying the database. I have s ...

Tips for displaying a pre-filter loading message using AngularJS

Is there a way to display a "Loading Message" prior to the filtered data being returned when using AngularJS for filtering? The filter process is quick, so displaying the message before returning the filtered data is not feasible. Here is an example of the ...

Searching for a specific word within a given string using a loop

Currently, I'm developing a 'for' loop to search for my name, Andrew, in a given text and store the occurrences in an array. However, there seems to be an issue with the implementation. /*jshint multistr:true */ var text = ("Andrew is real ...

Acquire an array of Worksheet names in JavaScript by utilizing ActiveX

How can I retrieve a comprehensive list of all available sheet names from my Excel file using the ActiveX Object? I am aware that the code Excel.ActiveWorkBook.Sheets provides access to the sheets. However, how do I obtain an array containing the NAMES of ...

Having trouble displaying the collection data from firebase using React

I am having an issue retrieving a collection from firebase and then using a map function to loop through the documents and render some UI elements. The data is correctly logged in the console at line 20, however, the map function doesn't seem to be wo ...