Last active
February 9, 2018 14:48
-
-
Save wehappyfew/348001735c41b40fdbe9 to your computer and use it in GitHub Desktop.
Fetch the number of nodes that are attached to selenium grid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def grid_nodes_num(grid_console_url="http://my_super_company.com:8080/grid/console#"): | |
| import requests | |
| from bs4 import BeautifulSoup | |
| r = requests.get(grid_console_url) | |
| html_doc = r.text | |
| soup = BeautifulSoup(html_doc) | |
| # print soup.prettify() # for debuggimg | |
| grid_nodes = soup.find_all("p", class_="proxyid") | |
| if grid_nodes == []: | |
| print "-No Nodes detected. Grid is down!-" | |
| else: | |
| nodes_num = len(grid_nodes) | |
| print "-Detected ",nodes_num," node(s)-" | |
| return nodes_num |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there any code implementation for Java ?