-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
C-pyPython BindingsPython Bindings
Description
Meta - is_url_connectable check for port , but just localhost url
OS: any SO
Selenium Version: Python 3.12.0
Browser: any browser
Browser Version: doesn't apply
Expected Behavior -
Can check from utils package if an url is connectable to specific host (hostname or ip) with method is_url_connectable(port)
adding new parameter host
?
or
¿Maybe rename method to is_port_connectable
?
Actual Behavior
Can't check from utils package if an url is connectable to specific host (hostname or ip) with method is_url_connectable(port)
Steps to reproduce -
I have 2 selenium GRIDs working, one at localhost and one at remote IP , why can't use this function to check boths grids, local and remote.
- Go to original file here and check before to start testcase:
selenium/py/selenium/webdriver/common/utils.py
Lines 116 to 136 in d1f4f50
def is_url_connectable(port): """ Tries to connect to the HTTP server at /status path and specified port to see if it responds successfully. :Args: - port - The port to connect. """ try: from urllib import request as url_request except ImportError: import urllib2 as url_request try: res = url_request.urlopen("http://127.0.0.1:%s/status" % port) if res.getcode() == 200: return True else: return False except Exception: return False - Execute this testcase
>>> from selenium.webdriver.common.utils import is_url_connectable
>>> is_url_connectable("4444")
False
>>> is_url_connectable("http://ntz-qa.tk:11000")
False
>>> is_url_connectable(11000)
True
Notes:
- Tried to use
find_connectable_ip
but isn't working as expected too, so can't use to resolve my problem
>>> from selenium.webdriver.common.utils import find_connectable_ip
>>> find_connectable_ip("http://qalab.tk:11000")
>>> find_connectable_ip("http://qalab.tk")
>>> find_connectable_ip("http://qalab.tk", port=11000)
>>> # was expecting return ip here :(
i can PR this if community are agree :)
Metadata
Metadata
Assignees
Labels
C-pyPython BindingsPython Bindings