Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use pubmed to realize automatic ticket grabbing function in Python

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

It is believed that many inexperienced people have no idea about how to use pubmed to realize automatic ticket grabbing function in Python. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

General Code:

For i in range (51 Select 56): driver.implicitly_wait (10) ActionChains (driver). Move_to_element (driver.find_element_by_xpath ('/ * [@ id= "save-results-panel-trigger"]')) .click () .perform () Select (driver.find_element_by_xpath ('/ * [@ id= "save-action-selection"]')) .select_by_visible_text ("All results on this page") ActionChains (driver) .move_to_element (driver.find_element_by_xpath ('/ * [@ id= "save-action-format"]')) .click () .perform () Select (driver.find_element_by_xpath ('/ html/body/main/div [1] / div/form/div [2] / select')) .select_by_visible_text ("CSV") ActionChains (driver). Move_to_element (driver.find_element_by) _ xpath ('/ / * [@ id= "save-action-panel-form"] / div [3] / button [1]') .click () .perform () target = driver.find_element_by_xpath ('/ / * [@ id= "search-results"] / section/div [3] / a Uniba span') driver.execute_script ("arguments [0]. () " Target) ActionChains (driver) .move_to_element (driver.find_element_by_xpath ('/ / * [@ id= "search-results"] / section/div [3] / a _ Acer span') .click () .perform () ActionChains (driver) .move_to_element (driver.find_element_by_xpath ('/ * [@ id= "search-page"] / div [12] / div/form/button')) .click (). Perform () Print ('page' + str (I) + 'page downloaded successfully') print ('jump first' + str (item1) + 'page') driver.quit () print ('download completed Exit automatically.')

Code 1

For i in range: printg ('I was wrong')

The operation is as follows: move the mouse to the Save button → mouse right-click → check

You can find that there is an area of the source code lit up.

This area is the Save button corresponding to the source code → mouse move to the source code area → right-click → copy → copy XPath

So we copy the Xpath of the Save button, and then just paste it into the code.

ActionChains's universal formula:

ActionChains (driver). Move_to_element (driver.find_element_by_xpath ('xpath_content')). Click (). Perform ()

All we need to do is paste the xpath we just copied into the "xpath_content" area of the code, as follows:

ActionChains (driver) .move_to_element (driver.find_element_by_xpath ('/ * [@ id= "save-results-panel-trigger"]') .click () .perform ()

Are you familiar with it? yes, this is the first operation we use the ActionChains module to achieve. The follow-up is the same. Just copy the corresponding Xpath and paste it directly.

Finally, because the above are all the contents of the loop body, when the code has finished executing the entire loop body, we can close the browser directly through the code to remind us that we have finished printing. The code is as follows

Driver.quit () print ('all downloaded, finished') after reading the above content, have you mastered how to use pubmed in Python to realize automatic ticket grabbing function? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report