Selenium node crashes shortly after opening
I am trying to do simple web testing with Selenium hub/node connection. Idea is to make some tests in Katalon IDE and then export them into python for the node to run. So I made my first test case, exported it to python and run it on standalone selenium node and it worked great.
Unfortunately, this test doesn't work if I try to run it from the hub to the node. It opens the node web browser on the starting page but it crashes shortly after, without doing anything from the test. I tried Firefox and chrome but I get the same results.
I am not good with python so I apologize if there is an easy fix I didn't see it myself.
Here is my testcase:
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
class OKGoogle(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Remote(
command_executor = 'http://192.168.1.244:4444/wd/hub',
desired_capabilities = {
'browserName': 'firefox',
'javascriptEnabled': True
})
def test_o_k_google(self):
driver = self.driver
driver.get("https://www.google.com/")
driver.find_element_by_id("lst-ib").clear()
driver.find_element_by_id("lst-ib").send_keys("ok google")
driver.find_element_by_id("lst-ib").send_keys(Keys.ENTER)
driver.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)=concat('Use ', '"', 'Ok Google', '"', ' voice searches & actions - Android - Google Search ...')])[1]/following::cite[1]").click()
def is_element_present(self, how, what):
try:
self.driver.find_element(by=how, value=what)
except NoSuchElementException as e:
return False
return True
def is_alert_present(self):
try:
self.driver.switch_to_alert()
except NoAlertPresentException as e:
return False
return True
def close_alert_and_get_its_text(self):
try:
alert = self.driver.switch_to_alert()
alert_text = alert.text
if self.accept_next_alert:
alert.accept()
else:
alert.dismiss()
return alert_text
finally: self.accept_next_alert = True
def tearDown(self):
self.driver.quit()
self.assertEqual(, self.verificationErrors)
if __name__ == "__main__":
unittest.main()
And the error I get:
Traceback (most recent call last):
File "OKGoogle.py", line 25, in test_o_k_google
driver.find_element_by_id("lst-ib").clear()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 360, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: Unable to locate element: [id="lst-ib"]
======================================================================
ERROR: test_o_k_google (__main__.OKGoogle)
----------------------------------------------------------------------
Traceback (most recent call last):
File "OKGoogle.py", line 53, in tearDown
self.assertEqual(, self.verificationErrors)
AttributeError: 'OKGoogle' object has no attribute 'verificationErrors'
----------------------------------------------------------------------
Ran 1 test in 10.453s
FAILED (errors=2)
Any help is very much appreciated.
python linux selenium katalon-studio katalon-recorder
add a comment |
I am trying to do simple web testing with Selenium hub/node connection. Idea is to make some tests in Katalon IDE and then export them into python for the node to run. So I made my first test case, exported it to python and run it on standalone selenium node and it worked great.
Unfortunately, this test doesn't work if I try to run it from the hub to the node. It opens the node web browser on the starting page but it crashes shortly after, without doing anything from the test. I tried Firefox and chrome but I get the same results.
I am not good with python so I apologize if there is an easy fix I didn't see it myself.
Here is my testcase:
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
class OKGoogle(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Remote(
command_executor = 'http://192.168.1.244:4444/wd/hub',
desired_capabilities = {
'browserName': 'firefox',
'javascriptEnabled': True
})
def test_o_k_google(self):
driver = self.driver
driver.get("https://www.google.com/")
driver.find_element_by_id("lst-ib").clear()
driver.find_element_by_id("lst-ib").send_keys("ok google")
driver.find_element_by_id("lst-ib").send_keys(Keys.ENTER)
driver.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)=concat('Use ', '"', 'Ok Google', '"', ' voice searches & actions - Android - Google Search ...')])[1]/following::cite[1]").click()
def is_element_present(self, how, what):
try:
self.driver.find_element(by=how, value=what)
except NoSuchElementException as e:
return False
return True
def is_alert_present(self):
try:
self.driver.switch_to_alert()
except NoAlertPresentException as e:
return False
return True
def close_alert_and_get_its_text(self):
try:
alert = self.driver.switch_to_alert()
alert_text = alert.text
if self.accept_next_alert:
alert.accept()
else:
alert.dismiss()
return alert_text
finally: self.accept_next_alert = True
def tearDown(self):
self.driver.quit()
self.assertEqual(, self.verificationErrors)
if __name__ == "__main__":
unittest.main()
And the error I get:
Traceback (most recent call last):
File "OKGoogle.py", line 25, in test_o_k_google
driver.find_element_by_id("lst-ib").clear()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 360, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: Unable to locate element: [id="lst-ib"]
======================================================================
ERROR: test_o_k_google (__main__.OKGoogle)
----------------------------------------------------------------------
Traceback (most recent call last):
File "OKGoogle.py", line 53, in tearDown
self.assertEqual(, self.verificationErrors)
AttributeError: 'OKGoogle' object has no attribute 'verificationErrors'
----------------------------------------------------------------------
Ran 1 test in 10.453s
FAILED (errors=2)
Any help is very much appreciated.
python linux selenium katalon-studio katalon-recorder
1
Reading the error messages, it looks like it's telling you the problem with each. For the first, you'll need to figure out why Selenium can't find the requested object -Unable to locate element: [id="lst-ib"]. For the second, your class has neither aninitmethod, nor an attribute forself.verificationErrors
– G. Anderson
Nov 20 at 18:00
@G.Anderson good points!
– Moshe Slavin
Nov 20 at 18:13
add a comment |
I am trying to do simple web testing with Selenium hub/node connection. Idea is to make some tests in Katalon IDE and then export them into python for the node to run. So I made my first test case, exported it to python and run it on standalone selenium node and it worked great.
Unfortunately, this test doesn't work if I try to run it from the hub to the node. It opens the node web browser on the starting page but it crashes shortly after, without doing anything from the test. I tried Firefox and chrome but I get the same results.
I am not good with python so I apologize if there is an easy fix I didn't see it myself.
Here is my testcase:
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
class OKGoogle(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Remote(
command_executor = 'http://192.168.1.244:4444/wd/hub',
desired_capabilities = {
'browserName': 'firefox',
'javascriptEnabled': True
})
def test_o_k_google(self):
driver = self.driver
driver.get("https://www.google.com/")
driver.find_element_by_id("lst-ib").clear()
driver.find_element_by_id("lst-ib").send_keys("ok google")
driver.find_element_by_id("lst-ib").send_keys(Keys.ENTER)
driver.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)=concat('Use ', '"', 'Ok Google', '"', ' voice searches & actions - Android - Google Search ...')])[1]/following::cite[1]").click()
def is_element_present(self, how, what):
try:
self.driver.find_element(by=how, value=what)
except NoSuchElementException as e:
return False
return True
def is_alert_present(self):
try:
self.driver.switch_to_alert()
except NoAlertPresentException as e:
return False
return True
def close_alert_and_get_its_text(self):
try:
alert = self.driver.switch_to_alert()
alert_text = alert.text
if self.accept_next_alert:
alert.accept()
else:
alert.dismiss()
return alert_text
finally: self.accept_next_alert = True
def tearDown(self):
self.driver.quit()
self.assertEqual(, self.verificationErrors)
if __name__ == "__main__":
unittest.main()
And the error I get:
Traceback (most recent call last):
File "OKGoogle.py", line 25, in test_o_k_google
driver.find_element_by_id("lst-ib").clear()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 360, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: Unable to locate element: [id="lst-ib"]
======================================================================
ERROR: test_o_k_google (__main__.OKGoogle)
----------------------------------------------------------------------
Traceback (most recent call last):
File "OKGoogle.py", line 53, in tearDown
self.assertEqual(, self.verificationErrors)
AttributeError: 'OKGoogle' object has no attribute 'verificationErrors'
----------------------------------------------------------------------
Ran 1 test in 10.453s
FAILED (errors=2)
Any help is very much appreciated.
python linux selenium katalon-studio katalon-recorder
I am trying to do simple web testing with Selenium hub/node connection. Idea is to make some tests in Katalon IDE and then export them into python for the node to run. So I made my first test case, exported it to python and run it on standalone selenium node and it worked great.
Unfortunately, this test doesn't work if I try to run it from the hub to the node. It opens the node web browser on the starting page but it crashes shortly after, without doing anything from the test. I tried Firefox and chrome but I get the same results.
I am not good with python so I apologize if there is an easy fix I didn't see it myself.
Here is my testcase:
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
class OKGoogle(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Remote(
command_executor = 'http://192.168.1.244:4444/wd/hub',
desired_capabilities = {
'browserName': 'firefox',
'javascriptEnabled': True
})
def test_o_k_google(self):
driver = self.driver
driver.get("https://www.google.com/")
driver.find_element_by_id("lst-ib").clear()
driver.find_element_by_id("lst-ib").send_keys("ok google")
driver.find_element_by_id("lst-ib").send_keys(Keys.ENTER)
driver.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)=concat('Use ', '"', 'Ok Google', '"', ' voice searches & actions - Android - Google Search ...')])[1]/following::cite[1]").click()
def is_element_present(self, how, what):
try:
self.driver.find_element(by=how, value=what)
except NoSuchElementException as e:
return False
return True
def is_alert_present(self):
try:
self.driver.switch_to_alert()
except NoAlertPresentException as e:
return False
return True
def close_alert_and_get_its_text(self):
try:
alert = self.driver.switch_to_alert()
alert_text = alert.text
if self.accept_next_alert:
alert.accept()
else:
alert.dismiss()
return alert_text
finally: self.accept_next_alert = True
def tearDown(self):
self.driver.quit()
self.assertEqual(, self.verificationErrors)
if __name__ == "__main__":
unittest.main()
And the error I get:
Traceback (most recent call last):
File "OKGoogle.py", line 25, in test_o_k_google
driver.find_element_by_id("lst-ib").clear()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 360, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: Unable to locate element: [id="lst-ib"]
======================================================================
ERROR: test_o_k_google (__main__.OKGoogle)
----------------------------------------------------------------------
Traceback (most recent call last):
File "OKGoogle.py", line 53, in tearDown
self.assertEqual(, self.verificationErrors)
AttributeError: 'OKGoogle' object has no attribute 'verificationErrors'
----------------------------------------------------------------------
Ran 1 test in 10.453s
FAILED (errors=2)
Any help is very much appreciated.
python linux selenium katalon-studio katalon-recorder
python linux selenium katalon-studio katalon-recorder
edited Dec 14 at 15:12
Mate Mrše
9941323
9941323
asked Nov 20 at 17:45
Cooper
62
62
1
Reading the error messages, it looks like it's telling you the problem with each. For the first, you'll need to figure out why Selenium can't find the requested object -Unable to locate element: [id="lst-ib"]. For the second, your class has neither aninitmethod, nor an attribute forself.verificationErrors
– G. Anderson
Nov 20 at 18:00
@G.Anderson good points!
– Moshe Slavin
Nov 20 at 18:13
add a comment |
1
Reading the error messages, it looks like it's telling you the problem with each. For the first, you'll need to figure out why Selenium can't find the requested object -Unable to locate element: [id="lst-ib"]. For the second, your class has neither aninitmethod, nor an attribute forself.verificationErrors
– G. Anderson
Nov 20 at 18:00
@G.Anderson good points!
– Moshe Slavin
Nov 20 at 18:13
1
1
Reading the error messages, it looks like it's telling you the problem with each. For the first, you'll need to figure out why Selenium can't find the requested object -
Unable to locate element: [id="lst-ib"]. For the second, your class has neither an init method, nor an attribute for self.verificationErrors– G. Anderson
Nov 20 at 18:00
Reading the error messages, it looks like it's telling you the problem with each. For the first, you'll need to figure out why Selenium can't find the requested object -
Unable to locate element: [id="lst-ib"]. For the second, your class has neither an init method, nor an attribute for self.verificationErrors– G. Anderson
Nov 20 at 18:00
@G.Anderson good points!
– Moshe Slavin
Nov 20 at 18:13
@G.Anderson good points!
– Moshe Slavin
Nov 20 at 18:13
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398663%2fselenium-node-crashes-shortly-after-opening%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398663%2fselenium-node-crashes-shortly-after-opening%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Reading the error messages, it looks like it's telling you the problem with each. For the first, you'll need to figure out why Selenium can't find the requested object -
Unable to locate element: [id="lst-ib"]. For the second, your class has neither aninitmethod, nor an attribute forself.verificationErrors– G. Anderson
Nov 20 at 18:00
@G.Anderson good points!
– Moshe Slavin
Nov 20 at 18:13