Trying to upload file to input tag via UI in Karate using LambdaTest Hub

58 views Asked by At

I'm working to try and access a file that was uploaded to LambdaTest storage via Karate. I've been able to successfully upload and delete files using the LambdaTest api: https://www.lambdatest.com/support/docs/upload-files-using-lambdatest/

Now, when I try to instantiate my driver using 'lambda:userFiles' as a capability:

* def makeArray =
    """
    function(pathString)
    {
      return [pathString]
    }
    """
* def filesToAdd = call makeArray filePath
* def lambdaTestOptions = {  build: '*******', username: '#(lambdaTestUser)', accessKey: '#(lambdaTestKey)', tunnel: true, network:  true, console: true, visual:  true }

* def session = { capabilities: { alwaysMatch: {  'lambda:userFiles': '#(filesToAdd)', 'LT:Options': '#(lambdaTestOptions)', acceptInsecureCert: true, browserName: 'chrome', browserVersion: 'latest', platformName: 'Windows 11', 'goog:chromeOptions': { args: [ 'window-size=1280,720', 'enable-automation', '--no-sandbox',  '--disable-dev-shm-usage', '--disable-extensions', '--disable-gpu', '--ignore-certificate-errors', '−−incognito', 'use-fake-ui-for-media-stream', '--remote-allow-origins=*' ] } } } }
    
* configure driver = { type: 'chromedriver', start: false, webDriverSession: '#(session)', webDriverUrl: '#(lambdaTestUrl)' }

I end up with this error message: driver config / start failed: webdriver session create status 400, {"status":400,"value":{"message":"lambda:userFiles capability should be array of strings"}}, options: {type=chromedriver, start=false, webDriverSession={capabilities={alwaysMatch={lambda:userFiles=[payroll_09112023133105.txt], LT:Options={build=, username=, accessKey=, tunnel=true, network=true, console=true, visual=true}, acceptInsecureCert=true, browserName=chrome, browserVersion=latest, platformName=Windows 11, goog:chromeOptions={args=["window-size=1280,720","enable-automation","--no-sandbox","--disable-dev-shm-usage","--disable-extensions","--disable-gpu","--ignore-certificate-errors","−−incognito","use-fake-ui-for-media-stream","--remote-allow-origins="]}}}}, webDriverUrl=http://*@hub.lambdatest.com/wd/hub, target=null}

I'm not sure why I'm getting this "should be array of strings" message as it appears the field is already an array. Also, if there are other ways that I can access my tag to load a file into it for testing, I would love to hear that. Currently, when I instantiate my driver locally without LT, I'm able to click the file input and insert my path via the file explorer. However, LambdaTest seems to be giving me trouble on that front.

I've tried hardcoding an array and I've tried removing the tag altogether to no avail. Curious if anyone has tried doing this before. Karate Version: 1.4.0 JDK: 19

0

There are 0 answers