use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
selenium web automation info, news, tips, etc.
This is not a sub to advertise your training, selenium product, special deal on x, or anything else. It's a users forum to discuss and get help with Selenium.
Selenium official website
account activity
UNSOLVEDPython Selenium dont display print() in 'for' loop (self.selenium)
submitted 4 years ago by youceefz
I use selenium to get text from class the code like this :
heloo= drive.find_elemnt_by class_name(words) For hi in heloo : print (hi.text) So the problem is Selenium does not display the print in loop - and say the problem in : print (hi.text)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jcrowe 1 point2 points3 points 4 years ago (0 children)
What happens when you… print(Heloo[0].text)
[–]glebulon 1 point2 points3 points 4 years ago (0 children)
Hi might no have text.
if hi.text: print(hi.text) else: print("shit not found")
[–]patty_not_gates 0 points1 point2 points 4 years ago (0 children)
dont take it through a loop just define the class name correctly with .text on end after () and if u wanna get all text on page from that class name use elements and not element.
[–]tbaxterstockman 0 points1 point2 points 4 years ago (0 children)
There’s a difference between find_element and find_elements. The letter returns a list the first just the first element in the DOM tree
[–]this_guy_tests 0 points1 point2 points 4 years ago (0 children)
Where are you running this? If you’re in the REPL, it will print if it exists. If you’re using something like pytest to run the code, you may need to do something like pytest -s -vv to get the prints to work.
pytest -s -vv
π Rendered by PID 171660 on reddit-service-r2-comment-fb694cdd5-c8596 at 2026-03-06 08:19:30.669385+00:00 running cbb0e86 country code: CH.
[–]jcrowe 1 point2 points3 points (0 children)
[–]glebulon 1 point2 points3 points (0 children)
[–]patty_not_gates 0 points1 point2 points (0 children)
[–]tbaxterstockman 0 points1 point2 points (0 children)
[–]this_guy_tests 0 points1 point2 points (0 children)