在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Python/ 如何同時選擇多個文件?

如何同時選擇多個文件?

登錄百度網(wǎng)盤后,我想一次選定2個文件

方法1:

path1 = driver.find_element_by_xpath('//a[@title="test1"]')
ActionChains(driver).move_to_element(path1).perform()
ActionChains(driver).context_click(path1).perform()
path2 = driver.find_element_by_xpath('//a[@title="test2"]')
ActionChains(driver).move_to_element(path2).perform()
ActionChains(driver).context_click(path2).perform()

方法2:

path = driver.find_element_by_xpath('//a[@title="test1"]|//a[@title="test2"]')
ActionChains(driver).move_to_element(path).perform()
ActionChains(driver).context_click(path).perform()

方法3:

path = driver.find_element_by_xpath('//a[@title="test1"or @title="test2"]')
ActionChains(driver).move_to_element(path).perform()
ActionChains(driver).context_click(path).perform()

三種方法都不行,運行后,發(fā)現(xiàn)只能選定最后一個文件test2 ,test1沒有處于選定狀態(tài)。

請問,如何同時選擇多個文件?

回答
編輯回答
離殤
driver.find_element_by_xpath('//a[@title="test1"]/../../../span').click()
driver.find_element_by_xpath('//a[@title="test2"]/../../../span').click()
2017年5月13日 19:23