Logging into WLC GUI with Python

If we need to automate the WLC GUI, I think the best automation application is Selenium.

In this article I will try to describe in detail how to use Selenium to log into the WLC GUI, so that Python novices can also implement it after reading this article.

1. Install selenium

Installing selenium is very simple, you can install it by typing the following command in cmd.

pip install selenium

2. Import Web Driver

ChromeDriver can be downloaded from the official website of the chromium. Of course you can also use Firefox, Safari, etc.

After downloading the file and extracting it, we need to import the webdriver module. And also need to use <webdriver.Chrome> to define the location of the webdriver.

from selenium import webdriver

wlc = webdriver.Chrome(‘C:/Users/wlc/Desktop/chromedriver.exe’)

3. Access the WLC GUI with webdriver

Let webdriver access the website we can use <get>.

If we need to login to the website, the usual steps are
Click the Login button and enter your username and password.

For the WLC login, we can use a simpler method to pass the username and password with the URL.

wlc.get(‘https://username:password@10.1.1.1/screens/frameset.html’)

We can try running the Python code, and if all goes well, we can see that the webdriver has successfully logged into the WLC GUI.

4. Code example

from selenium import webdriver

wlc = webdriver.Chrome(‘C:/Users/wlc/Desktop/chromedriver.exe’)
wlc.get(‘https://username:password@10.1.1.1/screens/frameset.html’)

Leave a Reply

Your email address will not be published.