Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

click button in selenium python

url = "https://yahoo.com"
driver = Firefox(executable_path="geckodriver.exe")
driver.get(url)
driver.find_element_by_css_selector("button.btn:nth-child(5)").click()
Comment

clicking a button in selenium python

# Finding and clicking elements using XPATH example

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

import time

driver = webdriver.Chrome("C:/chromeDriver/chromedriver")  # Make sure you have YOUR path to the chromedriver
driver.get("https://www.youtube.com/")
time.sleep(2)

# Clicking the menu button
driver.find_element(By.XPATH, "/html/body/ytd-app/div[1]/div/ytd-masthead/div[3]/div[1]/yt-icon-button[2]").click()
time.sleep(1)

# Clicking the 'Subscription' link
driver.find_element(By.XPATH, "/html/body/ytd-app/div[1]/tp-yt-app-drawer/div[2]/div/div[2]/div[2]/ytd-guide-renderer"
                              "/div[1]/ytd-guide-section-renderer[1]/div/ytd-guide-entry-renderer[4]/a").click()
Comment

python selenium click element

element.click()
Comment

click a button using selenium python

from selenium.webdriver import ActionChains
ActionChains(browser).click(element).perform()
Comment

PREVIOUS NEXT
Code Example
Python :: raise an APi error on django rest view 
Python :: how to change icon in pygame 
Python :: python shuffle list with seed 
Python :: python replace part in large file 
Python :: python des 
Python :: pandas how to start read csv at a certain row 
Python :: python check numpy arrays equal 
Python :: pandas repeat rows n times 
Python :: pyspark groupby sum 
Python :: how to swap tuple 
Python :: find angle mbc in python 
Python :: python print do not use scientific notation 
Python :: python sum of natural numbers recursion 
Python :: tenary operator python 
Python :: how to find the text inside button in tkinter 
Python :: get first element of ordereddict 
Python :: proper tree in data structure 
Python :: plot distribution seaborn 
Python :: python cartesian product 
Python :: python execute command with variable 
Python :: tkinter input box 
Python :: df drop based on condition 
Python :: count items in list 
Python :: django modelform style 
Python :: how to write your first python program 
Python :: python code formatter vs code 
Python :: selenium get back from iframe python 
Python :: python lexicographical comparison 
Python :: append file to list python 
Python :: dataframe, sort by columns 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =