diff --git a/tests/test_core.py b/tests/test_core.py index 6823783..a1ef4f6 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -29,7 +29,7 @@ def setUpClass(cls): options.add_argument('--disable-gpu') # Last I checked this was necessary. cls.driver = webdriver.Chrome(chrome_options=options,service=ChromeService(ChromeDriverManager().install())) - cls.selenium_tools = SeleniumTools(driver=cls.driver,parser_class=LXMLParser) + cls.selenium_tools = SeleniumTools(driver=cls.driver,parser=LXMLParser) cls.url = "https://www.example.com/" cls.example_file =os.path.join(os.path.dirname(__file__),'data/example.html') cls.selenium_tools.get(cls.url) @@ -44,8 +44,8 @@ def test_get_supported_browsers(self): self.assertIsInstance(supported_browsers, list) self.assertGreater(len(supported_browsers), 0) - def test_get_driver_sessionid(self): - session_id = self.selenium_tools.get_driver_sessionid() + def test_sessionid(self): + session_id = self.selenium_tools.sessionid() self.assertIsInstance(session_id, str) self.assertGreater(len(session_id), 0) diff --git a/tests/test_parser.py b/tests/test_parser.py new file mode 100644 index 0000000..dfce236 --- /dev/null +++ b/tests/test_parser.py @@ -0,0 +1,29 @@ + +import unittest + +from s_tool.parser import LxmlParser + + +class LxmlParserTestCase(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.parser = LxmlParser() + + def test_dropdown(self): + html_string = """ + + + + + """ + + expected_result = [('Option 1', '1'), ('Option 2', '2'), ('Option 3', '3')] + dropdown_options = self.parser.dropdown(html_string) + + self.assertEqual(expected_result,dropdown_options) + self.assertTrue(len(dropdown_options)==3) +