单击下拉列表“页面组”后未更新页面源

2024-09-27 02:18:52 发布

您现在位置:Python中文网/ 问答频道 /正文

未更新页面源。Beauty soup在python_button.click()之后获取页面源代码,而不是在py_button.click()之后。我希望在单击dropdown选项后选择页面源。请帮助我解决这个问题

python_button = driver.find_element_by_css_selector("a[href='/CitingArticles.do?product=WOS&SID=8B2ggJlEbmGqTLqT8Wq&search_mode=CitingArticles&parentProduct=WOS&parentQid=2&parentDoc=1&REFID=57952433&logEventUT=WOS:000231266300001&excludeEventConfig=ExcludeIfFromNonInterProduct']")
python_button.click()
py_button=driver.find_element_by_xpath("//select[@id='selectPageSize_bottom']/option[@value='50']")
py_button.click()


soup=BeautifulSoup(urlopen(driver.current_url), 'lxml')
table = soup.find("div", {"class": "search-results"})


inf=table.find_all("div",{"class": "search-results-content"})
for val in inf:
    titles=val.find_all('value')
    authors=val.find_all('a')

    for title in titles:
        if 'lang_id' in str(title):
            print(title.get_text())

    for author in authors:
        if 'title="Find more records by this author"' in str(author):
            print(author.get_text()+";")

Tags: inpyforsearchbytitledriverbutton

热门问题