我試圖解析驗證碼的網頁。驗證碼是由PHP產生:Selenium獲取呈現的php驗證碼圖像
<img src="/captcha.php" border="0" align="absmiddle">
我該怎麼辦:
self.driver = webdriver.Chrome()
img = self.driver.find_element_by_xpath('//table/tbody/tr/td/img')
scr = img.get_attribute('src')
但它包含captcha.php,我期待看到的base64。
有什麼辦法讓PHP腳本返回圖像?
您可以用截圖保存呢? http://stackoverflow.com/questions/37564932/selenium-cannot-screenshot-a-web-element –
是的,但保存後需要發送它captcha解決服務,所以我不能只發送整個頁面的截圖。也許我可以不知何故裁剪屏幕截圖。 – StackUser
如果您閱讀我之前評論的鏈接,您會發現如何裁剪屏幕截圖。 –