Home > other >  How to use the selenium control current open web page
How to use the selenium control current open web page

Time:01-14

How to use the selenium control current already open web pages, is already open not open yet

CodePudding user response:

The from selenium.webdriver.com mon. Keys import keys
The from the selenium. Webdriver. Support. The UI import the Select
Can be operated by these two classes of selenium

CodePudding user response:

reference 1/f, no hinder response:
from selenium.webdriver.com mon. Keys import keys
The from the selenium. Webdriver. Support. The UI import the Select
Can be operated by these two classes of selenium


To give an example?????? Is to control the open browser, oh

CodePudding user response:

I am new to python's new one, with reference to the others, then the following methods can be found by groping control already open web pages, in chrome V78.0.3904.70 edition, a corresponding version of the chromedriver, python3.8.7 close test of success!
Web_options=webdriver. ChromeOptions ()
Web_options. Binary_location=r 'C: \ Users \ username \ AppData \ Local, Google, Chrome \ Application \ Chrome exe'
# first to C: \ Users \ username \ AppData \ Local, Google, Chrome \ Application \ Chrome exe - remote - was debugging - port=9222 command line mode to open the browser
# or in a browser shortcuts will target plus "-- remote - was debugging - port=9222" and then click on the shortcut to open the browser, can launch a browser of the Debug mode
# and then in the setting of webdriver add debug address 127.0.0.1: "9222", so that can be operated in the browser has been running the current page, or open a new page in the current page
Web_options. Debugger_address="127.0.0.1:9222
"Browser=webdriver. Chrome (r 'D: \ \ Python38 \ \ application software download library chromedriver. Exe', the options=web_options)
# the get (' https://www.baidu.com ') here is the key: with the bank statement, it will open in the browser open the current page to specify url page
Time. Sleep (# 1) because it is already open the page operation, so the wait time not so long
The find_element_by_id (' kw). Send_keys (' webdriver ')
  • Related