Closed M-Zubair10 closed 1 year ago
You can use https://github.com/seleniumbase/SeleniumBase to do it. (It has a special undetected-chromedriver mode that works with headless mode.)
pip install -U seleniumbase
And then run the following with python
:
from seleniumbase import Driver
from seleniumbase import page_actions
driver = Driver(headless=True, uc=True)
driver.get("https://nowsecure.nl")
page_actions.wait_for_text(driver, "OH YEAH, you passed!", "h1")
print(driver.find_element("css selector", "body").text)
screenshot_name = "now_secure_image.png"
driver.save_screenshot(screenshot_name)
print("\nScreenshot saved to: %s" % screenshot_name)
driver.quit()
Thanks man you are a life saver!
Chromedriver console open with Pyinstaller
from seleniumbase import Driver from seleniumbase import page_actions driver = Driver(uc=True) driver.get("https://nowsecure.nl") page_actions.wait_for_text(driver, "OH YEAH, you passed!", "h1") print(driver.find_element("css selector", "body").text) screenshot_name = "now_secure_image.png" driver.save_screenshot(screenshot_name) print("\nScreenshot saved to: %s" % screenshot_name) driver.quit()
Chromedriver console open with Pyinstaller
Hi, I wanted to scrape websites in headless now, it works flawlessly in normal chrome but cloudflare is causing issue in headless Please give me any solution, even paid solution will be accepted, or new framework