0

I need to get element from page and then print it out But it always print out this:

[<selenium.webdriver.remote.webelement.WebElement (session="636e500d9db221d6b7b10b8d7849e1b5", 
    element="4f0ccc3b-44b0-4cf2-abd4-95a70278bf77")>...

My code:

film_player = free_filmy_url + filmPlayerPart
dr = webdriver.Chrome()
dr.get(film_player)
captcha_button = dr.find_element_by_xpath('/html/body/form/div/input[1]')
captcha_items = dr.find_elements_by_class_name('captchaMyImg')
print(captcha_items)
supputuri
  • 13,644
  • 2
  • 21
  • 39

2 Answers2

0

You can iterate through the captcha_items and print each of them.

for captcha_item in captcha_items:
    # you can access each item here as "captcha_item"
    print(captcha_item.text()) # if you are trying to print the text 

supputuri
  • 13,644
  • 2
  • 21
  • 39
0

Through your lines of code:

captcha_items = dr.find_elements_by_class_name('captchaMyImg')
print(captcha_items)

You are printing the elements.

Rather you must be looking to print an attribute of the elements and you can use the following solution:

print([my_elem.get_attribute("attribute") for my_elem in dr.find_elements_by_class_name('captchaMyImg')])

Note: You need to replace the text attribute with any of the existing attributes for those elements, e.g. src, href, innerHTML, etc.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352