Skip to content

A simple module that lets you access the fetch API with selenium!

License

Notifications You must be signed in to change notification settings

aprilahijriyan/selenium-fetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

selenium-fetch

A simple module that lets you access the fetch API with selenium!

Why do I make this? just annoyed with cloudflare. It works best with undetected-chromedriver.

Installation

pip install selenium-fetch undetected-chromedriver

Example

from undetected_chromedriver import Chrome
from selenium_fetch import fetch, Options, get_browser_user_agent

LOGIN_PAGE_URL = "https://smekdong.com/login"
LOGIN_API_URL = "https://smekdong.com/api/login"
driver = Chrome(headless=False)
driver.get(LOGIN_PAGE_URL)
post_data = {
    'username': 'blaabla',
    'password': 'xxxx'
}
headers = {
    "user-agent": get_browser_user_agent(driver),
    'origin': 'https://smekdong.com',
    'referer': 'https://smekdong.com/',
}
options = Options(method="POST", headers=headers, body=post_data)
response = fetch(driver, LOGIN_API_URL, options)
print("Response:", response)

About

A simple module that lets you access the fetch API with selenium!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages