How To Test Non-standard Drop Down Lists Through A Crawler Using Selenium And Python
I am in a university project building a cralwer for webpages. Now I encountered testing dropdown lists in webpage. Specifically, the following page does not use the standard 'dro
Solution 1:
Consider following the steps & lines of code to open the url & click on a menu:
- Install current version of selenium through pip
- Download the latest chromedriver.exe and provide the absolute path in your script
Code Block:
from selenium import webdriver driver=webdriver.Chrome("C:\\Utility\\your_directory\\chromedriver.exe") #maximize the browser window driver.maximize_window() #open the url in the browser driver.get("https://www.mirrorfiction.com/zh-Hant/book/406") #click on the first menu item 小說 driver.find_element_by_xpath("//nav[@id='nav']/div/ul/li/a/span[@class='text novel']").click()
Post a Comment for "How To Test Non-standard Drop Down Lists Through A Crawler Using Selenium And Python"