Going through a range of numbers in python that each are supposed to be typed into a searchbox on a website

Issue

maybe someone can help me, Im pretty new to coding
Im trying to go through a range of numbers that are each supposed to be typed into a searchbox on a website.
That is my sad try so far, does anyone have an idea? I guess its gotta be a little more complex than this

enter image description here

Solution

searchbar.send_keys('Numbers')

would send the word "Numbers" to the search bar, if you want to send the numbers themselves you could use a format string:

f"{Numbers}"

the f in front of the string "" indicates that it’s going to be a format string and the {} evaluate your variables. So:

a = hello
print(f"{a} world!")
>>> hello world!

Though in that case that alone would only send the list to the searchbar so you could use a loop to get over the numbers one by one:

for i in Numbers:
     searchbar.send(str(i))

or you could "".join(Numbers) into one string and send them all at once. Kinda depends on why you’re doing it and what you mean to accomplish with it.

Answered By – haxor789

Answer Checked By – David Goodson (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.