Home > Blockchain >  How to get element name or id in bootstrap carousel next button for Selenium Automation?
How to get element name or id in bootstrap carousel next button for Selenium Automation?

Time:08-30

I am trying to automate bootstrap carousel next button with Selenium. The code is given as follows:

from selenium import webdriver
import time
driver = webdriver.Chrome(executable_path='d:/CRD/chromedriver_win32/chromedriver.exe')
driver.get('file:///D:/slider/bootst.html')
button1 = driver.find_element(By.CLASS_NAME, "a.carousel-control")
button1.click()

The way I am trying to get the ID using chrome inspect element option as shown below: Inspecting carousel next button

How can I get the next button pressed automatically using Selenium.

CodePudding user response:

You can use other selectors like XPATH if you want, but I think you should use CSS SELECTOR for "a.right.carousel-control" not CLASS_NAME.

More explanation on stackoverflow

Have a great day !

  • Related