Skip to content

Instantly share code, notes, and snippets.

@wehappyfew
Last active February 9, 2018 14:48
Show Gist options
  • Select an option

  • Save wehappyfew/348001735c41b40fdbe9 to your computer and use it in GitHub Desktop.

Select an option

Save wehappyfew/348001735c41b40fdbe9 to your computer and use it in GitHub Desktop.
Fetch the number of nodes that are attached to selenium grid
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
@pavanbachu0604
Copy link
Copy Markdown

Is there any code implementation for Java ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment