How to run testcafe from local on chrome docker image

  docker, testcafe

I don’t want to install chrome to run testcafe and want to use a chrome docker image.
Step1:

docker run -d -p 4444:4444 selenium/standalone-chrome

Step2:

docker container ls
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                    NAMES
3487d6a08310        selenium/standalone-chrome   "/opt/bin/entry_poin…"   About an hour ago   Up About an hour    0.0.0.0:4444->4444/tcp   charming_proskuriakova

Step3: This code works for python2.7

from selenium import webdriver

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

driver=webdriver.Remote(
          command_executor='http://0.0.0.0:4444/wd/hub',
          desired_capabilities=DesiredCapabilities.CHROME)


driver.get("https://www.google.com/")  
print driver.title
driver.close() 

I am looking to use same functionality for testcafe. Base code(test1.js):

    import { Selector } from 'testcafe';

    fixture `Getting Started`
        .page `http://devexpress.github.io/testcafe/example`;

    test('My first test', async t => {
        // Test code
});

Execution on local Chrome:

testcafe chrome test1.js

I am looking for method to replace chrome with docker image. I know, chrome is inbuilt with testcafe, you can consider “safari” or any other browser in place of chrome. IDea is learn to use docker image in testcafe.
PS: I dont want to use testcafe/testcafe image since my issue is not running testcafe in docker , but only browser in docker.

Source: StackOverflow

LEAVE A COMMENT