【发布时间】:2019-05-15 11:35:31
【问题描述】:
嗨,我在 python 中有以下内容
#Searching for company
varA = soup.find(Microsoft)
#Finding the <a> tag which contains href
#{<a data-deptmodal="true" href="https://someURL BASED ON COMPANY NAME">TEXT BASED ON COMPANY NAME</a>}
button = org.find_previous('a')
driver.find_element_by_tag_name(button).click()
我得到一个类似的错误
TypeError: 'Tag' 类型的对象不是 JSON 可序列化的
我得到汤后如何让网络驱动程序点击我的href 请注意,每次我更改公司名称时,我的 href 都会更改。
【问题讨论】:
-
您不需要bs4,只需单击基于公司名称
driver.find_element_by_link_text("Microsoft").click()或driver.find_element_by_partial_link_text("Microsoft").click()的链接(如果"Microsoft"不是链接文本中的唯一字符串)
标签: python selenium-webdriver beautifulsoup