chore(deps): lock file maintenance #814
test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy ❌
❌ test-results/test.xml
15 tests were completed in 5847s with 0 passed, 15 failed and 0 skipped.
Test suite | Passed | Failed | Skipped | Time |
---|---|---|---|---|
pytest | 15❌ | 5847s |
❌ pytest
tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy
❌ test_proxy_fields_label_entity
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_fields_label_entity>>
❌ test_proxy_fields_placeholder_value
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_fields_placeholder_value>>
❌ test_proxy_default_configs
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_default_configs>>
❌ test_proxy_required_field_host
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_required_field_host>>
❌ test_proxy_host_valid_input
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_host_valid_input>>
❌ test_proxy_host_field_length_validation
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_host_field_length_validation>>
❌ test_proxy_required_field_port
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_required_field_port>>
❌ test_proxy_port_field_valid_range
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_port_field_valid_range>>
❌ test_proxy_port_field_out_of_range
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_port_field_out_of_range>>
❌ test_proxy_list_proxy_types
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_list_proxy_types>>
❌ test_proxy_required_field_proxy_type
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_required_field_proxy_type>>
❌ test_proxy_username_field_length_validation
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_username_field_length_validation>>
❌ test_proxy_encrypted_field_password
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_encrypted_field_password>>
❌ test_proxy_frontend_validation
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_frontend_validation>>
❌ test_proxy_backend_validation
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_backend_validation>>
Annotations
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_fields_label_entity
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_fields_label_entity>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_fields_label_entity>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_fields_label_entity>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_fields_label_entity>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b06745e0>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_fields_label_entity'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b06745e0>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0676650>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b06745e0>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0676650>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b06745e0>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0676650>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="390b4fe279c444518913cf59a6aec282")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="390b4fe279c444518913cf59a6aec282")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b0676020>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x00DACE43+45171]\\n\\t(No symbol) [0x00D390...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_fields_placeholder_value
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_fields_placeholder_value>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_fields_placeholder_value>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_fields_placeholder_value>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_fields_placeholder_value>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05352d0>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_fields_placeholder_value'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05352d0>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b05351e0>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05352d0>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b05351e0>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05352d0>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b05351e0>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="0a2c1b7935fa41059a5ef8425d36a92d")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="0a2c1b7935fa41059a5ef8425d36a92d")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b0535510>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x0085CE43+45171]\\n\\t(No symbol) [0x007E90...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_default_configs
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_default_configs>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_default_configs>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_default_configs>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_default_configs>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0838e20>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_default_configs'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0838e20>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0839750>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0838e20>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0839750>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0838e20>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0839750>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="fca89890b9dc46388a8c80115bdd16bc")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="fca89890b9dc46388a8c80115bdd16bc")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b0838880>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x00F3CE43+45171]\\n\\t(No symbol) [0x00EC90...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_required_field_host
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_required_field_host>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_required_field_host>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_required_field_host>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_required_field_host>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05127d0>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_required_field_host'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05127d0>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0513c10>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05127d0>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0513c10>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05127d0>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0513c10>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="f1635ed6a02c4ba5b51bd889d167019a")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="f1635ed6a02c4ba5b51bd889d167019a")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b0512bf0>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x004DCE43+45171]\\n\\t(No symbol) [0x004690...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_host_valid_input
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_host_valid_input>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_host_valid_input>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_host_valid_input>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_host_valid_input>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b066fc10>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_host_valid_input'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b066fc10>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b066dc90>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b066fc10>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b066dc90>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b066fc10>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b066dc90>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="67d0fa9304c943b4940bdcfb4afb25af")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="67d0fa9304c943b4940bdcfb4afb25af")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b066d7b0>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x002ACE43+45171]\\n\\t(No symbol) [0x002390...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_host_field_length_validation
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_host_field_length_validation>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_host_field_length_validation>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_host_field_length_validation>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_host_field_length_validation>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0537340>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_host_field_length_validation'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0537340>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0535d20>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0537340>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0535d20>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0537340>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0535d20>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="4fbf02c4da13461abd023b0c2caae518")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="4fbf02c4da13461abd023b0c2caae518")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b0534cd0>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x00A7CE43+45171]\\n\\t(No symbol) [0x00A090...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_required_field_port
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_required_field_port>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_required_field_port>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_required_field_port>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_required_field_port>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b04b5240>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_required_field_port'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b04b5240>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b04b6500>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b04b5240>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b04b6500>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b04b5240>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b04b6500>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="2855517906184cd4825806ebb028528b")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="2855517906184cd4825806ebb028528b")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b04b5870>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x002BCE43+45171]\\n\\t(No symbol) [0x002490...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_port_field_valid_range
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_port_field_valid_range>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_port_field_valid_range>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_port_field_valid_range>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_port_field_valid_range>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0513a60>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_port_field_valid_range'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0513a60>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0513fa0>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0513a60>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0513fa0>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b0513a60>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b0513fa0>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="d5c2bef842bb442fbe5757dc55c41403")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="d5c2bef842bb442fbe5757dc55c41403")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b0512350>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x00F9CE43+45171]\\n\\t(No symbol) [0x00F290...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_port_field_out_of_range
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_port_field_out_of_range>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_port_field_out_of_range>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_port_field_out_of_range>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_port_field_out_of_range>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b04dd360>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_port_field_out_of_range'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b04dd360>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b04dca90>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b04dd360>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b04dca90>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b04dd360>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b04dca90>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="c8c47503021b47089dec9881717cbad7")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="c8c47503021b47089dec9881717cbad7")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b04dd5d0>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x009DCE43+45171]\\n\\t(No symbol) [0x009690...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_list_proxy_types
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_list_proxy_types>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_list_proxy_types>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_list_proxy_types>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_list_proxy_types>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b052e950>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_list_proxy_types'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b052e950>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b052c220>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b052e950>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b052c220>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b052e950>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b052c220>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="76168dba76cd41a1a5dc20e8a78e4bf5")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="76168dba76cd41a1a5dc20e8a78e4bf5")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b052f040>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x0107CE43+45171]\\n\\t(No symbol) [0x010090...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Check failure on line 0 in test-results/test.xml
github-actions / test-report-9.0.6__chrome_test_splunk_ta_example_addon_proxy
pytest ► tests.ui.test_splunk_ta_example_addon_proxy.chrome_TestProxy ► test_proxy_required_field_proxy_type
Failed test found in:
test-results/test.xml
Error:
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_required_field_proxy_type>>
Raw output
request = <SubRequest 'ucc_smartx_selenium_wrapper' for <Function test_proxy_required_field_proxy_type>>
@pytest.fixture(scope="function", autouse=True)
def ucc_smartx_selenium_wrapper(request):
"""
Calls ucc_smartx_selenium_helper fixture
"""
if "ucc_smartx_selenium_helper" in request.fixturenames:
> request.node.selenium_helper = request.getfixturevalue(
"ucc_smartx_selenium_helper"
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_required_field_proxy_type>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
break
except Exception as e:
last_exc = e
LOGGER.warning(
"Failed to configure the browser or login to Splunk instance for - Try={} \nTRACEBACK::{}".format(
try_number, traceback.format_exc()
)
)
else:
LOGGER.error(
"Could not connect to Browser or login to Splunk instance. Please check the logs for detailed error of each retry"
)
> raise (last_exc)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
request = <SubRequest 'ucc_smartx_selenium_helper' for <Function test_proxy_required_field_proxy_type>>
ucc_smartx_configs = SmartConfigs(driver='chrome', driver_version='latest', local_run=False, retry_count=3, headless_run=False)
splunk = {'forwarder_host': 'splunk', 'host': 'splunk', 'password': 'Chang3d!', 'port': '8089', ...}
splunk_web_uri = 'http://splunk:8000/'
splunk_rest_uri = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
@pytest.fixture(scope=get_browser_scope)
def ucc_smartx_selenium_helper(
request, ucc_smartx_configs, splunk, splunk_web_uri, splunk_rest_uri
):
# Try to configure selenium & Login to splunk instance
test_case = "{}_{}".format(
ucc_smartx_configs.driver, request.node.nodeid.split("::")[-1]
)
for try_number in range(ucc_smartx_configs.retry_count):
last_exc = Exception()
try:
> selenium_helper = SeleniumHelper(
ucc_smartx_configs.driver,
ucc_smartx_configs.driver_version,
splunk_web_uri,
splunk_rest_uri,
debug=ucc_smartx_configs.local_run,
cred=(splunk["username"], splunk["password"]),
headless=ucc_smartx_configs.headless_run,
test_case=test_case,
)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/plugin.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05c1420>
browser = 'chrome', browser_version = 'latest'
splunk_web_url = 'http://splunk:8000/'
splunk_mgmt_url = (<requests.sessions.Session object at 0x7fe6b0778a00>, 'https://splunk:8089/')
debug = False, cred = ('admin', 'Chang3d!'), headless = False
test_case = 'chrome_test_proxy_required_field_proxy_type'
def __init__(
self,
browser,
browser_version,
splunk_web_url,
splunk_mgmt_url,
debug=False,
cred=("admin", "Chang3d!"),
headless=False,
test_case=None,
):
self.splunk_web_url = splunk_web_url
self.splunk_mgmt_url = splunk_mgmt_url
self.cred = cred
self.test_case = test_case
self.skip_saucelab_job = False
if "grid" in browser:
self.skip_saucelab_job = True
debug = True
if not debug:
# Using Saucelabs
self.init_sauce_env_variables()
try:
if browser == "firefox":
if debug:
self.browser = webdriver.Firefox(
firefox_options=self.get_local_firefox_opts(headless),
log_path="selenium.log",
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_firefox_opts(
browser_version
),
)
elif browser == "chrome":
if debug:
self.browser = webdriver.Chrome(
chrome_options=self.get_local_chrome_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_chrome_opts(
browser_version
),
)
# selenium local stack
elif browser == "chrome_grid":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://chrome-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_grid":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://firefox-grid:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
# kubernetes selenium
elif browser == "chrome_k8s":
google_cert_opts = {
"goog:chromeOptions": {
"w3c": True,
"args": ["ignore-certificate-errors", "ignore-ssl-errors=yes"],
}
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts("chrome", google_cert_opts),
)
elif browser == "firefox_k8s":
firefox_cert_opts = {
"acceptInsecureCerts": True,
"acceptSslCerts": True,
}
self.browser = webdriver.Remote(
command_executor="http://selenium-hub.selenium.svc.cluster.local:4444/wd/hub",
desired_capabilities=self.get_grid_opts(
"firefox", firefox_cert_opts
),
)
elif browser == "edge":
if debug:
self.browser = Edge(
executable_path="msedgedriver",
desired_capabilities=self.get_local_edge_opts(headless),
service_args=["--verbose", "--log-path=selenium.log"],
)
else:
command_executor = EdgeRemoteConnection(
"https://ondemand.saucelabs.com:443/wd/hub"
)
options = EdgeOptions()
options.use_chromium = True
self.browser = webdriver.Remote(
command_executor=command_executor,
options=options,
desired_capabilities=self.get_sauce_edge_opts(browser_version),
)
elif browser == "IE":
if debug:
self.browser = webdriver.Ie(capabilities=self.get_local_ie_opts())
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_ie_opts(browser_version),
)
elif browser == "safari":
if debug:
self.browser = webdriver.Safari()
else:
self.browser = webdriver.Remote(
command_executor="https://ondemand.saucelabs.com:443/wd/hub",
desired_capabilities=self.get_sauce_safari_opts(
browser_version
),
)
else:
raise Exception(
"No valid browser found.! expected=[firefox, chrome, safari], got={}".format(
browser
)
)
except Exception as e:
raise e
try:
self.browser_session = self.browser.session_id
> self.login_to_splunk(*self.cred)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:207:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05c1420>
cred = ('admin', 'Chang3d!')
def login_to_splunk(self, *cred):
try:
> login_page = LoginPage(self)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/base_test.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b05c0850>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05c1420>
def __init__(self, ucc_smartx_selenium_helper):
"""
:param ucc_smartx_selenium_helper: Fixture with selenium driver, urls(web, mgmt) and session key
"""
> super().__init__(ucc_smartx_selenium_helper, ucc_smartx_rest_helper=None)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/login.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b05c0850>
ucc_smartx_selenium_helper = <pytest_splunk_addon_ui_smartx.base_test.SeleniumHelper object at 0x7fe6b05c1420>
ucc_smartx_rest_helper = None, open_page = True
def __init__(
self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, open_page=True
):
"""
:param ucc_smartx_selenium_helper: The selenium webdriver
:param ucc_smartx_rest_helper: Splunk web & management url. {"web": , "mgmt": }
"""
if ucc_smartx_selenium_helper:
self.browser = ucc_smartx_selenium_helper.browser
self.splunk_web_url = ucc_smartx_selenium_helper.splunk_web_url
if open_page:
> self.open()
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_splunk_addon_ui_smartx.pages.login.LoginPage object at 0x7fe6b05c0850>
def open(self):
"""
Abstract Method. Open the page
"""
> self.browser.get(self.splunk_web_url)
/usr/local/lib/python3.10/dist-packages/pytest_splunk_addon_ui_smartx/pages/page.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="024d82186951496aaa6928fb52d5e17c")>
url = 'http://splunk:8000/'
def get(self, url):
"""
Loads a web page in the current browser session.
"""
> self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:333:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webdriver.WebDriver (session="024d82186951496aaa6928fb52d5e17c")>
driver_command = 'get', params = {'url': 'http://splunk:8000/'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if self.session_id is not None:
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py:321:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe6b05c0400>
response = {'status': 500, 'value': '{"value": {"stacktrace": "\\tGetHandleVerifier [0x0058CE43+45171]\\n\\t(No symbol) [0x005190...ge": "unknown error: net::ERR_NAME_NOT_RESOLVED\\n (Session info: chrome=117.0.5938.63)", "error": "unknown error"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
E (Session info: chrome=117.0.5938.63)
/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException