0

I have a javascript which I want to put in console when page loaded but i am unable to open console using selenium in python I can access devtoos using this --auto-open-devtools-for-tabs but not able to open console.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException
import os
import time
from urllib.parse import quote_plus

driverPath = "chromedriver.exe"
dataPath = "whatsapp-assistant-bot-master/Data"

options = webdriver.ChromeOptions()
options.add_argument("--user-data-dir=" + dataPath)
options.add_argument("--auto-open-console-for-tabs=" + dataPath)
driver = webdriver.Chrome(options=options, executable_path=driverPath)

driver.get('http://google.com')
print('Please Scan the QR Code and press enter')

 driver.find_element_by_id("gsr").send_keys(Keys.F12)



input()
driver.quit()

1 Answer 1

2

Answered here, you don't have to open the console, you can run your js code through selenium

Running javascript in Selenium using Python

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.