Selenium no such session error in ChromeDriver

Often I get such a session error when I run scripts from Jenkins. What is the reason for this? Is there any connection failure or is it due to some other reason (I am running through 26 scripts and out of it, although one script does not have such a session error)

Scripts are different scenarios, and such a session is not repeated again for the same scripts

+6
source share
2 answers

I sometimes met this incident. I am using ChromeDriver with Laravel Dusk, not Selenium. However, I believe the reason is in ChromeDriver, not Selenium

ChromeDriver : C:\Users\(yourAccountName)\AppData\Local\Temp. , scoped_dir1234_5678. 10 . Jenkins ChromeDriver , ChromeDriver . 30-50GB C C.

C , ChromeDriver , "Facebook\WebDriver\Exception\NoSuchDriverException: ".

:

  • temp, Chrome Cdriver Cache, C.
  • script, / Cache ChromeDriver.

- -

, .

script, ChromeDriver , , Chrome .

, Chromecredit scrpit, Jenkins .

, script, . script " " - broswer.

:

  • jenkins
  • , .

Laravel Dusk . , selenium

+4

pelon selenium, chromediver_binary selenium. driver.close() .

, , , setUpClass tearDownClass. , .

class SeleniumTestCase(TestCase):
    """
    A wrapper of TestCase which will launch a selenium server, login, and add
    cookies in the setUp phase of each test.
    """
    @classmethod
    def setUpClass(cls, *args, **kwargs):
        cls.driver = webdriver.Chrome(port=4444)
        cls.driver.implicitly_wait(15)
        cls.driver.maximize_window()
        cls.driver.get(HOST)
        # page obect I wrote which accepts the driver and can login to my app
        cls.login = LoginPage(cls.driver)
        cls.login.log_into_app()

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()

, :

class TestNavigation(SeleniumTestCase):

    def setUp(self):
        # Initialize page objects for each test
        self.module1 = Module1Page(self.driver)
        self.module2 = Module2Page(self.driver)
        # launch page
        self.driver.get(HOST)

    def test_module1(self):
        self.module1.nav_link.click()
        self.assertEqual(self.module1.title.text, 'Module One')

    def test_module2(self):
        self.module2.nav_link.click()
        self.assertEqual(self.module2.title.text, 'Module Two')

, SeleniumTestCase, , , test methodsdf , .

0

Source: https://habr.com/ru/post/1016246/


All Articles