1

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)

enter image description here

4
  • share some code. what u tried so far? if u got errors, share them too. this way u get more chances to be helped Commented Jan 2, 2023 at 16:58
  • Sorry, I didn't try because I have no idea how to do it Commented Jan 2, 2023 at 16:59
  • I only need a code snippet that runs a script in the console and gets a response Commented Jan 2, 2023 at 17:00
  • 1
    Does this answer your question? How to get JavaScript variables from a script tag using Python and Selenium Commented Jan 2, 2023 at 17:04

2 Answers 2

1
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)
Sign up to request clarification or add additional context in comments.

Comments

0

Selenium webdriver can execute Javascript. After loading a page, you can execute any javascript you want. A webdriver must be installed for selenium to work. All it takes to execute Javascript is calling the method execute_script(js) where js is your javascript code.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.