“Mengklik tombol di Selenium Python” Kode Jawaban

Klik tombol dalam 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()
Ankur

Klik tombol menggunakan selenium python

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

Mengklik tombol di 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()
Jassim12c

Jawaban yang mirip dengan “Mengklik tombol di Selenium Python”

Pertanyaan yang mirip dengan “Mengklik tombol di Selenium Python”

Lebih banyak jawaban terkait untuk “Mengklik tombol di Selenium Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya