How to Execute your script on existing(Open Browser) Browser for Debugging purpose
Below
are the few steps to following for execute your scripts on open chrome browser.
1) Find Where your chrome.exe
file in your local desktop/laptop
Ex: C:\Program Files
(x86)\Google\Chrome\Application
2) Set the path in
environment variable
You should open
your Chrome Browser in debug mode for that you should follow the below steps
1)
Open
the Command Prompt and enter below command
2)
chrome.exe
-remote-debugging-port=9009 --user-data-dir=C:\ChromeProfile\Debug
-remote-debugging-port=9009
9009 is the port number and assign it to -remote-debugging-port
It can be any number.
C:\ChromeProfile\Debug is Browser profile
directory and assign it to
--user-data-dir, it can give any directory
name and you can choose any drive.
Google Chrome browser will get launch once
you will run the above command in command line.
Enter the URL on opened browser and
navigate from where ever you want to execute your script.
Ex: You want to click on Continue button in
FLIGHT FINDER Page for that what you need to do is enter URL and navigate to
that page
Enter User Name and Password then click on
Sign-In button
Click on CONTINUE button
Below is the script for click on Continue button:
from selenium
import webdriver
from selenium.webdriver.chrome.options import Options
chromePath="C:\\BrowserDrivers\\chromedriver.exe"
chrome_opt=Options()
chrome_opt.debugger_address="LocalHost:9009"
driver=webdriver.Chrome(chromePath,options=chrome_opt)
driver.find_element_by_name("findFlights").click()
from selenium.webdriver.chrome.options import Options
chromePath="C:\\BrowserDrivers\\chromedriver.exe"
chrome_opt=Options()
chrome_opt.debugger_address="LocalHost:9009"
driver=webdriver.Chrome(chromePath,options=chrome_opt)
driver.find_element_by_name("findFlights").click()
Note : only on Google Chrome Browser and Browser version should be 66 and above.
Comments
Post a Comment