Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get xpath of element selenium python

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

#your executable_path will be different!!
driver = webdriver.Chrome(executable_path="C:/Development/chromedriver.exe")


driver.get("https://www.linkedin.com/jobs/search/?currentJobId=3271146120&f_AL=true&geoId=102257491&keywords=python%20developer&location=London%2C%20England%2C%20United%20Kingdom&refresh=true")

button = driver.find_element(By.XPATH, '/html/body/div[3]/header/nav/div/a[2]')
button.click()

email_field = driver.find_element(By.XPATH, '//*[@id="username"]')
password_field = driver.find_element(By.XPATH, '//*[@id="password"]')
sign_in_field = driver.find_element(By.XPATH, '//*[@id="organic-div"]/form/div[3]/button')
Comment

How to select element using xpath in python

# importing the HTMLSession class
from requests_html import HTMLSession
# create the object of the session
session = HTMLSession()
# url of the page
web_page = 'https://webscraper.io/'
# making get request to the webpage
respone = session.get(web_page)
# getting the html of the page
page_html = respone.html
# finding all divs which have h2 child using xpath
divs_parent_to_h2= page_html.xpath('//div//h2')
# printing the elements list
print(divs_parent_to_h2)Copy Code
Comment

PREVIOUS NEXT
Code Example
Python :: if it is square python 
Python :: DtypeWarning: Columns (7) have mixed types. Specify dtype option on import or set low_memory=False 
Python :: how to send a command to cmd using python 
Python :: Matching a pattern in python 
Python :: python path absolute 
Python :: getting url parameters with javascript 
Python :: takes 2 positional arguments but 3 were given 
Python :: inheritance in python 
Python :: show which columns in dataframe have NA 
Python :: self python 
Python :: pine script to python 
Python :: pandas count distinct values in column 
Python :: python if loop 
Python :: Open the .txt file 
Python :: raspbian run a python script at startup 
Python :: pandas difference between dates in hours 
Python :: list append python 3 
Python :: is python idle an ide 
Python :: django model queries 
Python :: ten minute mail 
Python :: python quiz answer stores 
Python :: pandas previous row 
Python :: comment multiple lines python 
Python :: python 3.6 release date 
Python :: optimize python code 
Python :: arduino loop array 
Python :: django loop through form errors 
Python :: how to get github repository access in python code directly 
Python :: how to make a ip tracker in python 
Python :: required depend filed odoo 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =