[問題] Selenium save_screenshot 解析度問題

看板Python作者 (煉)時間5年前 (2020/07/15 16:56), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
小弟要擷取網頁上的某個區塊 使用 mobileEmulation = {"deviceName": "iPhone 6 Plus"} options = webdriver.ChromeOptions() options.add_experimental_option('mobileEmulation', mobileEmulation) options.add_argument('--log-level=3') options.add_argument('–no-sandbox') driver = webdriver.Chrome(chrome_options=options, executable_path='C:\\chromedriver.exe') driver.get(url) driver.save_screenshot(path) 但是在抓的時候他會閃一下 抓出來的圖就跟原來的解析度不太一樣 導致我後來要用 im = im.crop((left, top, right, bottom)) 的時候 無法抓到正確的位置 不知道有沒有先進有遇過類似問題 是怎麼解決的呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.171.100.19 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1594803376.A.DD0.html
文章代碼(AID): #1V3iImtG (Python)
文章代碼(AID): #1V3iImtG (Python)