I need to send sessionId in POST request. (no problem with this). Before these, I need to run the code in the console and get the response back using Selenium (in the screenshot). Please help, I couldn't find a solution. I only need a code snippet that runs a script in the console and gets a response (driver.execute_script maybe)
-
share some code. what u tried so far? if u got errors, share them too. this way u get more chances to be helpedericmp– ericmp2023-01-02 16:58:31 +00:00Commented Jan 2, 2023 at 16:58
-
Sorry, I didn't try because I have no idea how to do itKaterina_GG– Katerina_GG2023-01-02 16:59:54 +00:00Commented Jan 2, 2023 at 16:59
-
I only need a code snippet that runs a script in the console and gets a responseKaterina_GG– Katerina_GG2023-01-02 17:00:56 +00:00Commented Jan 2, 2023 at 17:00
-
1Does this answer your question? How to get JavaScript variables from a script tag using Python and SeleniumGuapo– Guapo2023-01-02 17:04:18 +00:00Commented Jan 2, 2023 at 17:04
Add a comment
|
2 Answers
from seleniumwire import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_argument("--disable-blink-features=AutomationControlled")
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
driver.get("url")
test = driver.execute_script('return _sift_session_id')
print(test)
