How to set more than one potential arguments for Keyword Element Should Contain from SeleniumLibrary in Robot Framework [closed] - parameter-passing

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Could anyone help me with the following situation:
I need to check the value of a status cell in a table on a web page that can potentially have one of several different values (strings), for example: imported, done, failed.
I am using the keyword Element Should Contain from the SeleniumLibrary and would like to validate as a positive result, if the value is either imported, or done.
So far I only know how to check only for one of those, for example for imported, by using as an argument for the expected result - imported, however I need that in both cases, either imported or done, to be considered as passed.
Thank you very much in advance!

Suppose you can use for your purpose something like the following:
*** Settings ***
Library SeleniumLibrary
Test Teardown Close Browser
*** Variables ***
${BROWSER} Chrome
${URL} https://stackoverflow.com/questions/64679739/how-to-set-more-than-one-potential-arguments-for-keyword-element-should-contain
${ELEMENT_LOCATOR} //*[contains(text(), 'Ask Question')]
${EXPECTED TEXT 1} Ask Question
${EXPECTED TEXT 2} Anything else
*** Test Cases ***
Test with two acceptable values
Open Browser url=${URL}
... browser=${BROWSER}
${element}= Get webElement locator=${ELEMENT_LOCATOR}
${bool_result}= Set variable if '${element.text}' == '${EXPECTED TEXT 1}' or '${element.text}' == '${EXPECTED TEXT 2}'
... ${True}
... ${False}
Should be true ${bool_result}
... msg=Expected that element with locator '${ELEMENT_LOCATOR}' contains text '${EXPECTED TEXT 1}' or '${EXPECTED TEXT 2}', but got '${element.text}'
Close Browser
Here I've just created the boolean variable with the result of the comparison of my element's text and the acceptable two values (${EXPECTED TEXT 1} and ${EXPECTED TEXT 2}).

Related

Exception of 50000 characters at 'SpreadsheetApp.flush()' in Google Sheets? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm trying to import a list from my Gmail into a spreadsheet.
It has worked flawlessly several times, but I decided to do some cosmetic changes and now I get a baffling error:
var l = artikelen.length; //l = 40 in this case
var importSh = SpreadsheetApp.getActive().getSheetByName("import");
var range = importSh.getRange(2,1,l,1);
range.setBackground("#ab6e6e");
SpreadsheetApp.flush(); //throws error 'Input exceeds the limit of 50000 characters in a cel'
What is that? I'm not trying to put anything in a cell?? I'm just ordering to pick a range and set a colour AFAIK. Which in fact is not executed either...
What am I overlooking here?
Any suggestion will be welcome.
The culprit may be elsewhere in your code. Chances are that there is an attempt to put more than 50,000 characters in some cell.
Spreadsheet writes are lazy, and the error may only get shown when the script terminates, or at flush(), as the case seems to be here. To debug, add a flush() after every Range.setValues() and Range.setValue() call. Use console.log() to find what the values you are writing look like.

Erlang store file contents in a list [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
code
read_CNF_File(FileName)->
case file:read_file(FileName) of
{ok, Data} -> print(binary:split(Data, [<<"\n">>], [global]));
{error, Reason} -> Reason end.
print([]) -> ok;
print([L|List]) ->
L,
print(List).
[Pic Related] How do I store contents from a file into a list (ideally a list of every line), if I try to io:fwrite As in read_CNF_File it seems to store it the way I want, however once I try to call print with that it just passes As as an empty list, thanks.
It is your print function that does nothing.
If you pass it à non empty list, it removes the first element (A in your code), the statement A, does nothing, and then recursively call itself with the tail of the list, until it is empty a' finally returns OK.

invalid command name in TCL [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
invalid command name "if{0}{"
Giving me an error, for that I have find how many cell in the file.
Where am I making a mistake?
Update::::::::::::::::::::::::::::::::::::::::::::::::::::::::
I am having an issue while sorting an array...
It says
enter image description here
Since the last element is integer, still it says "expected integer but got...
Where am i making mistake?
You must place a space between 'if' and the opening brace.
Basicly, the Tcl interpreter tokenizes commands by searching for whitespace, while at the same time substituting stuff inside []. So first, the regexpr is evaluated, yieling 0 and togehter with the remaining characters this yields the command name.

Read info from hyperlink located remotely (know that by hyperlink it will be csv file, but can't find general approach) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am using Python 3.4. I have tried find solution in the web, but still didn't.
I have a link to csv file (data set).
Is there a way to fetch information from this link without duplicating it in the local directory?(e.g., I don't have enough space on the disk)
I would like to continue working with data that will be in the RAM.(e.g., I am planning to find out how many datarows and have to do some Data Mining and Filtering stuff, currently not important what it will be)
Try the following:
import requests
r = requests.get('http://127.0.0.1/some_path/small.csv')
print len(r.content.split('\n')) -1
Result:
10
for small.csv file as follows:
1lpcfgokakmgnkcojhhkbfbldkacnbeo,6B5108
pjkljhe2ncpnkpknbcohdijeoejaedia,678425
apdfllc5aahabafndbhieahigkjlhalf,651374
aohghmighlieiainnegkcijnfilokake,591116
coobgpohoikkiipiblmjeljniedjpjpf,587200
dmgjnkhnkblpmfjpdakehnaikgdjllic,540979
felcaaldnbdncclmgdcncolpebgiejap,480535
aapocclcgogkmnckokdopfmhonfmgoek,480441
pdehmppfilefbolgganhfihpbmjlgebh,273609
nafaimnnclfjfedmmabolbppcngeolgf,105979
Edit: (As suggested by MHawke)
import requests
line_cnt=0
r = requests.get('http://127.0.0.1/some_path/small.csv',stream=True)
for i in r.iter_lines():
if i.strip():
line_cnt +=1
print (line_cnt)
This version does not count blank lines and should be more efficient for a large file because it uses iter_lines
iter_lines(chunk_size=512, decode_unicode=None, delimiter=None)
Iterates over the response data, one line at a time. When
stream=True is set on the request, this avoids reading the content at
once into memory for large responses.
(Note: not re-entrant safe)

How to write a function output into .txt file? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have to write a function that produces random(parameter) integers i have to write random output of this funtion into .txt file. Also i have to find max and min integers from this function (write them into .txt too)
I cant find any tutorial about this subject. Want to use "a+" as writer.
Firstly, please have a look online for tutorials on how to write to a file. There are loads of free resources online.
You have already done a lot of the work and only needed few more lines
import random
def createRandomNumberFile(min, max, count, outputFileName):
outputFile = open(outputFileName, 'a+')
for item in range(0, count):
randomNumber = random.randint(min,max)
outputFile.write(randomNumber)
outputFile.close
Explanation - As you have assigned the file using the 'a+' mode (appending mode) to a variable (outputFile) you can simply use this variable to write to the file and then later close file (closing the file isn't always necessary but is good practice).
Hope that helps