Python Selenium处理内部滚动-如何在div内滚动
这是我的网站要测试: 在网站的(RHS)分数部分,我想滚动到最上面的卡片 我尝试使用了Python Selenium处理内部滚动-如何在div内滚动,python,selenium-webdriver,pytest,Python,Selenium Webdriver,Pytest,这是我的网站要测试: 在网站的(RHS)分数部分,我想滚动到最上面的卡片 我尝试使用了scrollIntoView()和moveToElement操作: top_card=driver.find_element_by_xpath( "(// div[@class ='si-matBox si-matchBlock si-link-active si-format-t20 si-matCompleted si-cricket'])[1]")
scrollIntoView()
和moveToElement
操作:
top_card=driver.find_element_by_xpath(
"(// div[@class ='si-matBox si-matchBlock si-link-active si-format-t20 si-matCompleted si-cricket'])[1]")
actions.move_to_element(top_card).perform()
top_card.click()
这是:
main_div = driver.find_elements_by_xpath(""//div[@class='si-fixCntnr si-fix-widget']"")
for list in main_div :
driver.execute_script("arguments[0].scrollIntoView();", top_card )
它们似乎都不起作用。我是否正确使用了这些动作?或者有没有其他方法来选择最上面的卡片