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 :: change value in pandas dataframe cell 
Python :: load saved model 
Python :: selenium page down key python 
Python :: how to make a text input box python pygame 
Python :: NotImplementedError: Please use HDF reader for matlab v7.3 files 
Python :: python dockerfile 
Python :: ipywidgets pip 
Python :: random from list python 
Python :: python plot lines with dots 
Python :: plt off axis 
Python :: how to print char of element in list of pytohn 
Python :: python exit button 
Python :: python extract every nth value from list 
Python :: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. 
Python :: python split string capital letters 
Python :: how to find the lowest value in a nested list python 
Python :: python print list with newline 
Python :: Add help text in Django model forms 
Python :: update python 3.10 ubuntu 
Python :: how to get the current web page link in selenium pthon 
Python :: how to concat csv files python 
Python :: Function to a button in tkinter 
Python :: django rest framework configuration 
Python :: python format only 1 decimal place 
Python :: python3.9 venv returned non-zero exit status 1 
Python :: print key of dictionary python 
Python :: function as parameter tpye hinting python 
Python :: set axis ticks matplotlib 
Python :: python Pandas pivot on bin 
Python :: pil to rgb 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =