Python Forum
Selenium Random Elements Id and class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selenium Random Elements Id and class
#1
I have been trying to extract data using selenium from a website that I have an id:
https://login.systemxlite.com/

But the problem is that every time I refresh the page. it shows up new element id and class name, how do I extract data from such websites?

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import time
import requests

browser = webdriver.Chrome()
url = 'https://login.systemxlite.com/'
browser.get(url)
input_username = browser.find_element_by_class_name("input _1Y8XGj9ENGBa-Ik7Bcb8Lb")
input_username.send_keys('@gmail.com')
input_username.send_keys(Keys.RETURN)
input_pass = browser.find_element_by_class_name("text-input required  _1KA9k-sgH-_43Niwayzyxm LbnuI5kKQX1mPuG5AszFO")
input_pass.send_keys('xxxxx')
inputpass.send_keys(Keys.RETURN)
inputElement=browser.find_element_by_class_name('button _3CaodLH2MHcC-s3TXsSzoY button-primary _2YLlc1kIUzVCgwVOIxC2QJ')
inputElement.click()
Reply
#2
There are few differnet ways to still obtain select an element. You could use the absoute xpath value as you do not need any attributes. Or you can use the tagname since that one page has so little.

browser = webdriver.Chrome()
url = 'https://login.systemxlite.com/'
browser.get(url)

inputs = browser.find_elements_by_tag_name('input')

inputs[0].send_keys('[email protected]')
inputs[1].send_keys('1234')
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can't get elements by class on this website Cknutson575 5 3,183 Mar-10-2021, 07:16 AM
Last Post: Cknutson575
  Locating elements via Selenium peterjv26 2 2,467 Oct-02-2020, 07:50 AM
Last Post: peterjv26
  Selenium cant get elements from HTML(Rookie) Troop 1 2,161 Mar-31-2020, 03:37 AM
Last Post: Larz60+
  Getting error when accessing elements in a modal window of an webpage using selenium sumandas89 3 8,642 Jul-13-2018, 10:44 AM
Last Post: mlieqo
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,621 Nov-03-2017, 08:41 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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