我想盡可能保持我的選擇器簡(jiǎn)單,并且只在絕對(duì)必要的情況下使用 XPath。因此,而不是等待一個(gè)XPath像//*[@class='files']/tbody/tr[1]/th[text()='filename']我寧愿要等待組合的簡(jiǎn)單的CSS選擇器.files tbody tr:first-child和簡(jiǎn)單的XPath th[text()='filename']。presence_of_element_located只需要一個(gè)定位器,所以presence_of_element_located((By.CSS_SELECTOR, '.files tbody tr:first-child'), (By.XPATH, 'th[text()='filename']'))出來(lái)了。我也不能鏈接這些函數(shù),所以presence_of_element_located((By.CSS_SELECTOR, '.files tbody tr:first-child')).presence_of_element_located((By.XPATH, 'th[text()='filename']'))不起作用。
如何在 Python WebDriver 中等待 CSS 和 XPath 選擇器的組合?
繁星點(diǎn)點(diǎn)滴滴
2021-07-29 22:20:42