你好,我是python的初学者,我对从这里去哪里感到困惑使用bs4搜索后,如何与特定链接进行交互/单击?因此,在我的脚本中,我使用bs4搜索链接,这些链接可以在网页中单击,并带有特定的关键字,因此我单击了正确的产品。onSale = False # Set while loop variableshoeName = 'moon' # Set keyword to look forbrowser = webdriver.Chrome()browser.get(r'https://www.nike.com/launch/?s=upcoming') # Get URL to scansoup = BeautifulSoup(browser.page_source, 'html.parser') # Convert URL to a soup objectwhile onSale is False: # Create loop to keep checking inventoryfor link in soup.find_all('a', class_=r'card-link d-sm-b'): shoeCode = str((link.get('href', None), link.get_text())) compareName = re.sub("[^\w]", " ", shoeCode.lower()).split() # Takes the link and converts it into a string if shoeName in compareName: # Checks to see if the keyword is used # Interact/Click link else: print(shoeCode) continue找到正确的链接后,如何使用它与网站进行交互?我是否使用selenium,urllib和or请求?谢谢!
添加回答
举报
0/150
提交
取消