![]() ![]() I am expecting a random string to be assigned to the variable which is global and can be used and referred to throughout the other page objects enter code hereand keywords. Input text $= Generate random string 8 ĭepending on the code - I can run it and as it doesnt pick up the keyword it inserts 'Generate random surname' as the surname into the form Or atm I am getting the 'keyword name cannot be empty' this is using the keyword method but it is obv not generating or passing the string to the final keyword. Replace String Using Regexp, Split To Lines) and verifying their contents (e.g. String is Robot Framework's standard library for manipulating strings (e.g. The 'Input surname' keyword is on the following page with the current code: A library for string manipulation and verification. The 'Fill in about you page' has the following keyword: test is to check documents are attached in db Tried to use set global variable keyword within a keyword, tried to run the keyword while assigning it as a variable. I have tried creating keywords and test cases to return the variable. Use Select from list by index keyword on your list (from Selenium2Library) using the random index you generated in the previous step. common.robot - this has my keywords for common functions such as logging into the DB and bringing back data generate a random index using Generate Random String or sample like mentioned in this question. FormKeywords - This is just a file which contains keywords for each page of the form so it can call the keywords in about page in a logical orderĤ. I have tried calling fake.md5(rawoutputFalse) directly from my keyword and also by creating a variable and assigning it this value, but neither has the intended effect. AboutPage.robot - This file contains all variables and keywords to fill out each field on the first page of the formģ. Ive been trying to use the faker library to generate data without having it in my test cases as static data. Tests.robot - This is the runtime file and actual file i will have my test casesĢ. I have the following files which i have / can pull in as resources so that the variable is able to be recognized in each file. ![]() While it is included when you install RobotFramework, you have to explicitly import the Library in the Settings section. I have tried numerous things, and read and researched a lot but still cannot get it and its probably something small im missing. Generate Random String is part of the String library. My issue is I cannot seem to assign the variable using the keyword whilst keeping it global. Later in the code I then want to be able to compare this variable in the database against what was input into the form. I have the field 'surname' and i want to input a random string and assign to a variable. Read the information that follows for important application notes.I have automated filling out an online form using selenium driver, I then converted all my hard coded input to variables, now i am trying to generate random strings for a couple of the variables that must change to make the form submission work each time. Here's some fairly simple and very flexible code for generating random identifiers. To generate a random string, concatenate characters drawn randomly from the set of acceptable symbols until the string reaches the desired length. $Īnd what you get when you execute it: $ pybot ts.txtĪttempting to log with login login and password 30865042Īnother execution would generate another random number: $ pybot ts.txtĪttempting to log with login login and password 88780307 ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |