Concatenation error when running the robot from command line
I have made a big suite test that does a lot of actions, I use visual studio code and when I run the tests from vs code there is no problem, but when I run from command line I got this error (the command is correct) : TypeError: can only concatenate str (not "bytes") to str.
If I run "robot --include All test/.robot" I got this error
if I run "robot --include All --dryrun test/.robot", there are no error
I am using RPA.Browser.Selenium, String, JSONLibrary, each up to date.
I have checked, I use the same version of robot framework with visual studio and in command line. My files are in utf8
Here a screenshot of the error
formation.robot
*** Settings ***
Library RPA.Browser.Selenium
Library String
*** Variables ***
${NAVIGATEUR} chrome
${URL} file:///C:/Users/eps14/Documents/Travaux/VDL/Agir/formation/formation.html
#input
${fname} xpath=//input[@id="fname"]
${lname} xpath=//input[@id="lname"]
${civilite} xpath=//input[@id="*"]
${date naissance} xpath=//input[@id="bdate"]
${email} xpath=//input[@id="email"]
${input file} xpath=//input[@id="myfile"]
${input formation} xpath=//input[@id="formation"]
${input date} xpath=//input[@id="bdate"]
#select
${select word} xpath=//select[@id="word"]
#choose
${prenom} N
${nom} P
${sex} H
${mail} [email protected]
${date} 11.04.1997
${file} ${EXECDIR}${/}data${/}document.pdf
@{formations} f1 f2
*** Test Cases ***
Connection
Open Browser on FORM ${URL}
Remplir nom et prenom
Remplir le text ${fname} ${prenom}
Remplir le text ${lname} ${nom}
Remplir le text ${email} ${mail}
Saisir le sex
${string} Replace String ${civilite} * ${sex}
Wait Until Element Is Visible ${string}
Click Element ${string}
Saisir la date
Remplir le text ${input date} ${date}
Inserer document
Choose File ${input file} ${file}
Selectionner les formations
Choisir formation @{formations}
Select in select
Select From List By Value ${select word} 1
Sleep 2s
Select From List By Label ${select word} Foutriquet
Sleep 2s
Select From List By Index ${select word} 8
Click ON ME
Click Element //p[@onclick]
Sleep 5s
Handle Alert
*** Keywords ***
Open Browser on FORM
[Arguments] ${url}
Open Browser browser=${NAVIGATEUR} options=add_experimental_option("excludeSwitches", ["enable-logging"])
Go To ${url} #Se connecte au form
Maximize Browser Window
Put char in textfield
[Documentation] docu
[Arguments] ${string} ${textfield}
@{chars} Split String To Characters ${string}
FOR ${char} IN @{chars}
Input Text ${textfield} ${char} False
Sleep 500ms
END
Remplir le text
[Arguments] ${input} ${value}
Input Text ${input} ${value}
Choisir formation
[Arguments] @{formations values}
Log ${formations values}
FOR ${f} IN @{formations values}
${string} Replace String ${input formation} formation ${f}
Wait Until Element Is Visible ${string}
Click Element ${string}
Sleep 500ms
END
formation.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>
<form>
<p>Indique tes informations personnelles</p>
<label for="fname">Prénom</label><br>
<input id="fname" name="fname" type="text"/><br>
<label for="lname">Nom</label><br>
<input id="lname" name="lname" type="text"/><br>
<input type="radio" id="H" name="civi" value="H">
<label for="H">Homme</label><br>
<input type="radio" id="F" name="civi" value="F">
<label for="F">Femme</label><br>
<label for="bdate">Date de naissance</label><br>
<input id="bdate" name="bdate" type="date"><br>
<label for="email">Email</label><br>
<input id="email" name="email" type="email" maxlength="30"/><br>
<label for="myfile">Sélectionne ta photo</label><br>
<input type="file" id="myfile" name="myfile">
<p>Choisi les formations que tu veux</p>
<input type="checkbox" id="f1" name="f1" value="f1">
<label for="f1">Formation 1</label><br>
<input type="checkbox" id="f2" name="f2" value="f2">
<label for="f2">Formation 2</label><br>
<input type="checkbox" id="f3" name="f3" value="f3">
<label for="f3">Formation 3</label><br>
<label for="word">Choisi le mot qui te plait le plus dans la liste </label><br>
<select name="word" id="word">
<option value="1">Avocette</option>
<option value="2">Branquignol</option>
<option value="3">Bacbuc</option>
<option value="4">Cassoulet</option>
<option value="5">Embrouillamini</option>
<option value="6">Foutriquet</option>
<option value="7">Jussion</option>
<option value="8">Nullipare</option>
<option value="9">Obvie</option>
<option value="10">Parpaing</option>
</select>
<p id="clickOnMe" onclick="alert('You clicked, thank you')">Click on me</p>
</form>
</div>
</body>
</html>
After some test, I am sure that the problem come from RPA.Browser.Selenium, because when I change :
Open Browser on FORM
[Arguments] ${url}
Open Browser about::blank browser=${NAVIGATEUR} options=add_experimental_option("excludeSwitches", ["enable-logging"])
Go To ${url} #Se connecte au form
Maximize Browser Window
It work with the command line, but what I don't understand is that I can launch it in vscode before this change.
If you are running from the command line outside of an environment managed by rcc you are using a different set of dependencies. You would need to confirm all dependencies are exactly the same between your global installation and the conda.yaml used in VSCode. In order to ensure the dependencies are the same, you can run the robot through rcc with the command:
rcc task run -t <task name>
This task assumes you have a robot.yaml in the root of the robot which rcc can use to work off of.
This is actually a bug from our side since we introduced a check through ensure_scheme() which makes sure the URL you provide has a scheme. But when such a URL is actually None (not provided) or bytes, the logic isn't checking against this and it tries to operate on None/bytes where a string is expected, thus causing that error. (and maybe other similar)
Thank you for reporting!