Best Python code snippet using SeleniumBase
bls_cs_home_page.py
Source: bls_cs_home_page.py
...21 self.open("https://blsvnint.brayleinosplash.com/")22 self.maximize_window()23 sleep(3)24 self.click('//a[@class="btn btn-ico btn-prev"]', delay=2)25 self.get_link_status_code('link:/work.html', True, 2)26 self.assert_title('Work - Bray Leino Splash Vietnam ')27 # Checking if each case study content is visible28 def test_case_study_contents(self):29 err_lst = []30 self.open("https://blsvnint.brayleinosplash.com/")31 self.maximize_window()32 sleep(3)33 elements = self.find_elements(34 '//div[@class="bls-select"]//select[@class="btn-select--white invisible"]//option')35 elements = self.find_elements(36 '//div[@class="case-studies__topic"]//div[@class="bls-select"]//ul[@class="bls-options"]/li')37 for i in range(len(elements)):38 if elements[i].get_attribute('class') == 'selected':39 current_active_item = i40 self.assert_('selected', current_active_item)41 break42 print("Total elements: ", len(elements))43 print(list(elements))44 print(len(elements))45 for i in range(len(elements) - 2):46 # self.assert_element('//div[@class="case-studies__topic"]//div[@class="bls-select"]//ul['47 # '@class="bls-options"]//li[@class="selected"]',"")48 self.click('//a[@class="btn btn-ico btn-next"]', delay=2)49 self.is_element_visible('//div[@id="divCaseStudyDescription"]//div[@class="desc"]//p')50 self.is_element_visible('//div[@class="case-studies-slide__wrapper"]//div[@class="img"]')51 self.is_element_visible('//div[@class="case-studies-slide__wrapper"]//div[@class="img"]//span['52 '@class="text-left"]')53 self.is_element_visible('//div[@class="case-studies-slide__wrapper"]//div[@class="desc"]')54 # div#divCaseStudySlide a55 link_cs = self.get_attribute('//div[@class="case-studies-slide__wrapper"]//a[@class="btn btn-secondary"]',56 'href')57 print(link_cs)58 status = self.get_link_status_code(link_cs)59 if status == 200:60 err_lst.append(1)61 else:62 err_lst.append(0)63 print('404 Link:', link_cs)64 link_to_current_cs = self.get_link_status_code('//ul[@class="case-studies__carousel bls-carousel__slider '65 'no-bls-carousel"]//a[@class="btn btn-secondary"]')66 if link_to_current_cs == 200:67 err_lst.append(1)68 else:69 err_lst.append(0)70 print('404 Link:', link_to_current_cs)71 link_to_all_cs = self.get_link_status_code('//div[@class="cmd text-center"]//a[@class="btn btn-text '72 'btn-text--white"]')73 if link_to_all_cs == 200:74 err_lst.append(1)75 else:76 err_lst.append(0)77 print('404 Link:', link_to_all_cs)78 # Checking is slider is available if the slider item >179 is_slider_visible = self.is_element_visible('//div[@class="bls-carousel"]//div['80 '@class="bls-carousel__dots"]//button['81 '@class="bls-carousel__dot"]')82 if is_slider_visible != '':83 slider_items_arr = self.find_elements(84 '//div[@class="case-studies-slide__wrapper"]//div[@class="bls-carousel"]//div['85 '@class="bls-carousel__dots"]')...
bls_live_cs_home_page.py
Source: bls_live_cs_home_page.py
...21 self.open("https://www.brayleinosplash.com.sg/")22 self.maximize_window()23 sleep(3)24 self.click('//a[@class="btn btn-ico btn-prev"]', delay=2)25 self.get_link_status_code('link:/work.html', True, 2)26 self.assert_title('Work - Bray Leino Splash Vietnam ')27 # Checking if each case study content is visible28 def test_case_study_contents(self):29 err_lst = []30 self.open("https://www.brayleinosplash.com.sg/")31 self.maximize_window()32 sleep(3)33 elements = self.find_elements(34 '//div[@class="bls-select"]//select[@class="btn-select--white invisible"]//option')35 elements = self.find_elements(36 '//div[@class="case-studies__topic"]//div[@class="bls-select"]//ul[@class="bls-options"]/li')37 for i in range(len(elements)):38 if elements[i].get_attribute('class') == 'selected':39 current_active_item = i40 self.assert_('selected', current_active_item)41 break42 print("Total elements: ", len(elements))43 print(list(elements))44 print(len(elements))45 for i in range(len(elements) - 2):46 # self.assert_element('//div[@class="case-studies__topic"]//div[@class="bls-select"]//ul['47 # '@class="bls-options"]//li[@class="selected"]',"")48 self.click('//a[@class="btn btn-ico btn-next"]', delay=2)49 self.is_element_visible('//div[@id="divCaseStudyDescription"]//div[@class="desc"]//p')50 self.is_element_visible('//div[@class="case-studies-slide__wrapper"]//div[@class="img"]')51 self.is_element_visible('//div[@class="case-studies-slide__wrapper"]//div[@class="img"]//span['52 '@class="text-left"]')53 self.is_element_visible('//div[@class="case-studies-slide__wrapper"]//div[@class="desc"]')54 # div#divCaseStudySlide a55 link_cs = self.get_attribute('//div[@class="case-studies-slide__wrapper"]//a[@class="btn btn-secondary"]',56 'href')57 print(link_cs)58 status = self.get_link_status_code(link_cs)59 if status == 200:60 err_lst.append(1)61 else:62 err_lst.append(0)63 print('404 Link:', link_cs)64 link_to_current_cs = self.get_link_status_code('//ul[@class="case-studies__carousel bls-carousel__slider '65 'no-bls-carousel"]//a[@class="btn btn-secondary"]')66 if link_to_current_cs == 200:67 err_lst.append(1)68 else:69 err_lst.append(0)70 print('404 Link:', link_to_current_cs)71 link_to_all_cs = self.get_link_status_code('//div[@class="cmd text-center"]//a[@class="btn btn-text '72 'btn-text--white"]')73 if link_to_all_cs == 200:74 err_lst.append(1)75 else:76 err_lst.append(0)77 print('404 Link:', link_to_all_cs)78 # Checking is slider is available if the slider item >179 is_slider_visible = self.is_element_visible('//div[@class="bls-carousel"]//div['80 '@class="bls-carousel__dots"]//button['81 '@class="bls-carousel__dot"]')82 if is_slider_visible != '':83 slider_items_arr = self.find_elements(84 '//div[@class="case-studies-slide__wrapper"]//div[@class="bls-carousel"]//div['85 '@class="bls-carousel__dots"]')...
test_404.py
Source: test_404.py
...20 def testNot404OnLogout(self):21 self.open(base_url + '/logout')22 self.assert_element_absent("#Error-funny")23 def test404OnSell(self):24 assert str(self.get_link_status_code(base_url + "/sell")).startswith('40')25 def test404OnBuy(self):26 assert str(self.get_link_status_code(base_url + "/buy")).startswith('40')27 def test404OnUpdate(self):28 assert str(self.get_link_status_code(base_url + "/update")).startswith('40')29 def test404(self):30 self.open(base_url + "/asdf")...
Check out the latest blogs from LambdaTest on this topic:
The QA testing profession requires both educational and long-term or experience-based learning. One can learn the basics from certification courses and exams, boot camp courses, and college-level courses where available. However, developing instinctive and practical skills works best when built with work experience.
Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.
In general, software testers have a challenging job. Software testing is frequently the final significant activity undertaken prior to actually delivering a product. Since the terms “software” and “late” are nearly synonymous, it is the testers that frequently catch the ire of the whole business as they try to test the software at the end. It is the testers who are under pressure to finish faster and deem the product “release candidate” before they have had enough opportunity to be comfortable. To make matters worse, if bugs are discovered in the product after it has been released, everyone looks to the testers and says, “Why didn’t you spot those bugs?” The testers did not cause the bugs, but they must bear some of the guilt for the bugs that were disclosed.
Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.
When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!