Best Python code snippet using playwright-python
items.py
Source:items.py
1from __future__ import annotations2from hues import COLOR3test_item = {4 'uid': 'test_item',5 'name': 'test item',6 'description': 'A simple whatchamacallit. Nothing special.',7 'display': {8 'char': ord("!"),9 'color': (255, 0, 0),10 'bg': (0, 0, 0)11 },12 'slot': None,13 'components': [('Physics', {'size': 'large'})]14 }15test_helmet = {16 'uid': 'test_helmet',17 'name': 'Simple Helmet',18 'description': '',19 'display': {20 'char': 57617,21 'color': COLOR['silver'],22 'bg': (0, 0, 0)23 },24 'slot': 'head',25 'components': [('Physics', {'size': 'large'})]26 }27test_cuirass = {28 'uid': 'test_cuirass',29 'name': 'Simple Cuirass',30 'description': '',31 'display': {32 'char': 57618,33 'color': COLOR['silver'],34 'bg': (0, 0, 0)35 },36 'slot': 'torso',37 'components': [('Physics', {'size': 'large'})]38 }39test_greaves = {40 'uid': 'test_greaves',41 'name': 'Simple Greaves',42 'description': '',43 'display': {44 'char': 57619,45 'color': COLOR['silver'],46 'bg': (0, 0, 0)47 },48 'slot': 'legs',49 'components': [('Physics', {'size': 'large'})]50 }51test_belt = {52 'uid': 'test_belt',53 'name': 'Simple Belt',54 'description': '',55 'display': {56 'char': 57620,57 'color': COLOR['brown'],58 'bg': (0, 0, 0)59 },60 'slot': 'waist',61 'components': [('Physics', {'size': 'large'})]62 }63test_boots = {64 'uid': 'test_boots',65 'name': 'Simple Boots',66 'description': '',67 'display': {68 'char': 57621,69 'color': COLOR['brown'],70 'bg': (0, 0, 0)71 },72 'slot': 'feet',73 'components': [('Physics', {'size': 'large'})]74 }75test_chest = {76 'uid': 'test_chest',77 'name': 'Chest',78 'description': '',79 'display': {80 'char': 57648,81 'color': (200, 100, 100),82 'bg': (0, 0, 0),83 },84 'slot': None,85 'components': [('Physics', {'size': 'large'})]86 }87test_scroll = {88 'uid': 'test_scroll',89 'name': 'Scroll',90 'description': '',91 'display': {92 'char': 57632,93 'color': (255, 122, 78),94 'bg': (0, 0, 0),95 },96 'slot': None,97 'components': [('Physics', {'size': 'large'})]98 }99test_longsword = {100 'uid': 'test_longsword',101 'name': 'Longsword',102 'description': '',103 'display': {104 'char': 57600,105 'color': COLOR['silver'],106 'bg': (0, 0, 0)107 },108 'slot': 'right_hand',109 'components': [('Physics', {'size': 'large'})]110 }111item_templates = {112 test_item['uid']: test_item,113 test_helmet['uid']: test_helmet,114 test_cuirass['uid']: test_cuirass,115 test_greaves['uid']: test_greaves,116 test_belt['uid']: test_belt,117 test_boots['uid']: test_boots,118 test_chest['uid']: test_chest,119 test_scroll['uid']: test_scroll,120 test_longsword['uid']: test_longsword,...
test_search.py
Source:test_search.py
...50 pylastica.Search.OPTION_SCROLL_ID: scroll_id51 })52 self.assertFalse(result.response.has_error())53 index.delete()54 def test_scroll(self):55 search = pylastica.Search(self._get_client())56 index = self._create_index("test_scroll")57 doc_type = index.get_doc_type("test")58 doc_type.add_documents([Document(i, {"clicks": randint(0, 100)}) for i in range(0, 100)])59 index.refresh()60 search.add_index(index)61 doc_ids = set()62 for result in search.scroll("2m", options={"size": 11}):63 doc_ids.add(result.get_id())64 self.assertEqual(100, len(doc_ids))65if __name__ == '__main__':...
test_formy_scroll_01.py
Source:test_formy_scroll_01.py
...19 yield20 driver.close()21 driver.quit()22 print('Test Completed')23 def test_scroll(self, test_setup):24 driver.find_element_by_link_text('Page Scroll').click()25 name_field = driver.find_element_by_id('name')26 actions = ActionChains(driver)27 actions.move_to_element(name_field)28 name_field.send_keys('J. Test')29 sleep(1)30 date = driver.find_element_by_id('date')31 date_string = datetime.datetime.now().strftime('%m/%d/%Y')32 date.send_keys(date_string)33 sleep(1)34class TestScrollFirefox():35 @pytest.fixture()36 def test_setup(self):37 global driver38 driver = webdriver.Firefox(executable_path=driver_path+'geckodriver')39 driver.implicitly_wait(10)40 driver.maximize_window()41 driver.get('https://formy-project.herokuapp.com/')42 yield43 driver.close()44 driver.quit()45 print('Test Completed')46 def test_scroll(self, test_setup):47 driver.find_element_by_link_text('Page Scroll').click()48 name_field = driver.find_element_by_id('name')49 actions = ActionChains(driver)50 actions.move_to_element(name_field)51 name_field.send_keys('J. Test')52 sleep(1)53 date = driver.find_element_by_id('date')54 date_string = datetime.datetime.now().strftime('%m/%d/%Y')55 date.send_keys(date_string)...
test_scroll.py
Source:test_scroll.py
...29 self.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)30 self.driver.implicitly_wait(3)31 def teardown(self):32 self.driver.quit()33 def test_scroll(self):34 self.driver.find_element(MobileBy.ANDROID_UIAUTOMATOR,35 'new UiScrollable(new UiSelector()'36 '.scrollable(true).instance(0))'37 '.scrollIntoView(new UiSelector()'38 '.text("å
³äºå¹³æ¿çµè").instance(0));').click()...
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!