我有一個page,它有一個我需要刪除的表(表id =「ctl00_ContentPlaceHolder_ctl00_ctl00_GV」class =「GridListings」)。 我通常使用BeautifulSoup & urllib,但在這種情況下,問題是表需要一些時間來加載,所以當我嘗試使用BS獲取時,它並未被捕獲。 我不能使用PyQt4的,drysracpe或風車因爲一些安裝問題,所以唯一可能的方式是使用硒/ PhantomJS 我嘗試以下,仍然沒有成功:需要廢棄通過ajax使用python加載的表格(selenium)
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.PhantomJS()
driver.get(url)
wait = WebDriverWait(driver, 10)
table = wait.until(EC.presence_of_element_located(By.CSS_SELECTOR, 'table#ctl00_ContentPlaceHolder_ctl00_ctl00_GV'))
上面的代碼犯規給我表中所需的內容。 我該如何去實現這個?
你是什麼意思不給我想要的內容?有什麼異常嗎?你能不能在這裏分享你的表格HTML? –
嗨,[鏈接](https://seahawks.strmarketplace.com/Charter-Seat-Licenses/Charter-Seat-Licenses.aspx)底部表是我想要的(表類=「GridListings」) – user3425403
我'對不起,但我不能查看錶格這一次,這就是爲什麼我告訴你在這裏分享表格HTML .. –