In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to query Zen Tao through selenium whether there is a task or BUG". In daily operation, I believe many people have doubts about how to query Zen Tao through selenium whether there is a task or BUG problem. I have consulted all kinds of materials and sorted out simple and easy operation methods. I hope to answer your doubts about "how to query Zen Tao through selenium whether there is a task or BUG"! Next, please follow the small series to learn together!
Python Selenium Instance Query Zen Dao via Selenium if there is a quest or BUG
1. Encapsulate the selenium driver
from selenium import webdriverdriver = webdriver.Chrome()driver.set_window_size(1920, 1350)driver.set_page_load_timeout(7000)driver.set_script_timeout(7000)driver.set_window_position(300, 50)
2. Encapsulate some common methods of obtaining elements of selenium
def fe_id(driver, id, send_keys): e = driver.find_element_by_id(id) e.send_keys(send_keys)def fe_name(driver, name, send_keys): e = driver.find_element_by_name(name) e.send_keys(send_keys)def fe_xpath(driver, xpath, send_keys): e = driver.find_element_by_xpath(xpath) e.send_keys(send_keys)def fe_id_click(driver, id): e = driver.find_element_by_id(id) e.click()def fe_name_click(driver, name): e = driver.find_element_by_name(name) e.click()def fe_xpath_click(driver, xpath): e = driver.find_element_by_xpath(xpath) e.click()def fe_id_clear(driver, id): e = driver.find_element_by_id(id) e.clear()def fe_name_clear(driver, name): e = driver.find_element_by_name(name) e.clear()def fe_xpath_clear(driver, xpath): e = driver.find_element_by_xpath(xpath) e.clear()def get_text_xpath(driver, xpath): e = driver.find_element_by_xpath(xpath) return e.textdef get_text_id(driver, id): e = driver.find_element_by_id(id) return e.textdef get_text_name(driver, name): e = driver.find_element_by_name(name) return e.text
3. Code example
from auto_selenium import config_selenium from auto_selenium.fast_set import *from time import sleepdriver = config_selenium.driver#See if Zen Path has a task def chandao(): driver.get ('your Zen address') fe_xpath(driver, '//*[@id="account"]', 'your Zen account') fe_xpath(driver,'//*[@id="loginPanel"]/div/div[2]/form/table/tbody/tr[2]/td/input','Your Zen Password') fe_xpath_click(driver, '//*[@id="submit"]') sleep(1) task = get_text_xpath(driver, '//*[@id="block102"]/div[2]/div/div[2]/div/div[1]/div[2]') bug = get_text_xpath(driver, '//*[@id="block102"]/div[2]/div/div[2]/div/div[2]/div[2]') need = get_text_xpath(driver, '//*[@id="block102"]/div[2]/div/div[2]/div/div[3]/div[2]') if int(task) > 0: print ('There is a task') return if int(bug) > 0: print ('BUG ') return if int(need) > 0: print ('Required ') return print ('Nothing Content') if __name__ == '__main__': chandao() driver.close()
4. Operation
Fig.
At this point, the study on "how to query Zen Tao through selenium whether there is a task or BUG" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.