

Initialize a driver and specify the path of the chromedriver driver = webdriver.Chrome(executable_path=driver_path) Let's talk about how Selenium and chromedriver can get started quickly:Ībsolute path of chromedriver driver_path = r'D:\ProgramApp\chromedriver\chromedriver.exe' Now let's take a simple example of getting Baidu's home page.
WEBDRIVE IMPLICIT VS EXPLICIT WAIT INSTALL
Install chromedriver: after downloading, put it into the pure English directory without permission. Install Selenium: Selenium is available in many languages, including java, ruby, python, etc.
WEBDRIVE IMPLICIT VS EXPLICIT WAIT ACTIVATION CODE
The following lists the different browsers and their corresponding drivers:įor more explanations on the use of pychar activation code tutorial, see: Of course, there are different drivers for different browsers.

Only by using it can you drive the browser. chromedriver is a driver of Chrome browser. It can simulate some human behaviors on the browser and automatically process some behaviors on the browser, such as clicking, filling in data, deleting cookie s and so on. Selenium+chromedriver to obtain dynamic data: What the browser can request, you can also request using selenium. Selenium directly simulates the behavior of the browser. The analysis interface is complex, especially some interfaces confused through js. The analysis interface can request data directly. Use Selenium+chromedriver to simulate browser behavior and obtain data.Īdvantages and disadvantages of the method Then request this interface through code. For the data loaded with Ajax, even if JS is used to render the data to the browser, you can't see the data loaded through Ajax in right click - > view web page source code, but only the html code loaded with this url.ĭirectly analyze the interface called by ajax. In fact, now data interaction basically uses JSON. Because the traditional transmission data format uses XML syntax. Traditional web pages (without Ajax) must reload the whole web page if they need to update the content. This means that a part of a web page can be updated without reloading the whole web page. Ajax can make web pages update asynchronously by exchanging a small amount of data with the server in the background. Ajax (asynchronous JavaScript and XML) asynchronous JavaScript and XML.
