Python Forum
Selenium returning web element instead of desired text
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selenium returning web element instead of desired text
#1
I just started web scrapping and decided to play around with Selenium. Below is the code I wrote to just login to the website and attempt to grab some data.

from selenium import webdriver

driver = webdriver.Chrome(r"C:\Users\hones\Desktop\MWO data\chromedriver.exe")

login_screen = driver.get("https://mwomercs.com/profile/leaderboards")
username = driver.find_element_by_id("email").send_keys("login_here")
password = driver.find_element_by_id("password").send_keys("some_password")
submit = driver.find_element_by_xpath("//*[@id='loginForm']/form/button").click()

stats = driver.find_elements_by_xpath("//*[@id='contentBody']/div[2]/table/tbody/tr[1]")
print(stats)

Everything works fine and no error message is presented. However, instead of returning the number I am trying to scrape, it returns something entirely different and it is displayed below.

[<selenium.webdriver.remote.webelement.WebElement (session="ebff9ddc3b927111b738557f1767aa58", element="d02991c8-c093-4d57-97e7-53b5bc8f75bd")>]

How would I go about getting past this and getting the data I am after? Thanks in advance for any feedback that is given.
Reply


Messages In This Thread
Selenium returning web element instead of desired text - by newbie_programmer - Dec-11-2019, 03:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium suddenly fails to find element Pavel_47 3 6,393 Sep-04-2022, 11:06 AM
Last Post: Pavel_47
  selenium wait for text question Larz60+ 3 2,588 Oct-25-2021, 09:50 AM
Last Post: Larz60+
  BeautifulSoup returning text as N/A tantony 6 2,801 Sep-09-2021, 12:59 PM
Last Post: tantony
  Path to the desired value Irv1n 2 2,067 Jul-25-2021, 05:30 AM
Last Post: ndc85430
  How to get specific TD text via Selenium? euras 3 8,896 May-14-2021, 05:12 PM
Last Post: snippsat
  Selenium extract id text xzozx 1 2,145 Jun-15-2020, 06:32 AM
Last Post: Larz60+
  Help extracting text from element jpdallas 7 3,560 Apr-30-2020, 06:26 AM
Last Post: anbu23
  Getting text using Selenium WiPi 10 4,946 Apr-27-2020, 08:58 AM
Last Post: WiPi
  Clicking on element not triggering event in Selenium Python (Event Key is not in data dkaeloredo 2 4,311 Feb-16-2020, 05:50 AM
Last Post: dkaeloredo
  Selenium locating an element. JokerTux 3 2,736 Dec-28-2019, 08:50 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020