Best Python code snippet using selene_python
Noro Mosely.py
Source:Noro Mosely.py
...12 hero_title_fontfamily = "Campaign, sans-serif"13 hero_title_fontsize = "55px"14 hero_title_lineheight = "60px"15 hero_title_spaceletter = "normal"16 if hero_title_fontfamily != hero_title.value_of_css_property('font-family'):17 print("Son distintos los font family title")18 print(hero_title.value_of_css_property('font-family'))19 hero_title.screenshot("title.png")20 if hero_title_fontsize != hero_title.value_of_css_property('font-size'):21 print("Son distintos los font size del title")22 print(hero_title.value_of_css_property('font-size'))23 hero_title.screenshot("title.png")24 if hero_title_lineheight != hero_title.value_of_css_property('line-height'):25 print("Son distintos del title")26 print(hero_title.value_of_css_property('line-height'))27 hero_title.screenshot("title.png")28 if hero_title_spaceletter != hero_title.value_of_css_property('letter-spacing'):29 print("Es distinto el letter spacing del title")30 print(hero_title.value_of_css_property('letter-spacing'))31 hero_title.screenshot("title.png")32 hero_subtitle = self.driver.find_elements_by_id()33 hero_subtitle_fontfamily = "Campaign, sans-serif"34 hero_subtitle_fontsize = "20px"35 hero_subtitle_lineheight = "22px"36 hero_subtitle_spaceletter = "normal"37 if hero_subtitle_fontfamily != hero_subtitle.value_of_css_property('font-family'):38 print("Son distintos los font family title")39 print(hero_subtitle.value_of_css_property('font-family'))40 hero_subtitle.screenshot("title.png")41 if hero_subtitle_fontsize != hero_subtitle.value_of_css_property('font-size'):42 print("Son distintos los font size del title")43 print(hero_subtitle.value_of_css_property('font-size'))44 hero_subtitle.screenshot("title.png")45 if hero_subtitle_lineheight != hero_subtitle.value_of_css_property('line-height'):46 print("Son distintos del title")47 print(hero_subtitle.value_of_css_property('line-height'))48 hero_subtitle.screenshot("title.png")49 if hero_subtitle_spaceletter != hero_subtitle.value_of_css_property('letter-spacing'):50 print("Es distinto el letter spacing del title")51 print(hero_subtitle.value_of_css_property('letter-spacing'))52 hero_subtitle.screenshot("title.png")53 def test_tipoLF(self):54 self.driver.implicitly_wait(10)55 leftRight_title = self.driver.find_elements_by_id()56 leftRight_title_fontfamily = "Campaign, sans-serif"57 leftRight_title_fontsize = "35px"58 leftRight_title_lineheight = "40px"59 leftRight_title_spaceletter = "normal"60 if leftRight_title_fontfamily != leftRight_title.value_of_css_property('font-family'):61 print("Son distintos los font family title")62 print(leftRight_title.value_of_css_property('font-family'))63 leftRight_title.screenshot("title.png")64 if leftRight_title_fontsize != leftRight_title.value_of_css_property('font-size'):65 print("Son distintos los font size del title")66 print(leftRight_title.value_of_css_property('font-size'))67 leftRight_title.screenshot("title.png")68 if leftRight_title_lineheight != leftRight_title.value_of_css_property('line-height'):69 print("Son distintos del title")70 print(leftRight_title.value_of_css_property('line-height'))71 leftRight_title.screenshot("title.png")72 if leftRight_title_spaceletter != leftRight_title.value_of_css_property('letter-spacing'):73 print("Es distinto el letter spacing del title")74 print(leftRight_title.value_of_css_property('letter-spacing'))75 leftRight_title.screenshot("title.png")76 leftRight_copy = self.driver.find_elements_by_id()77 leftRight_copy_fontfamily = "Campaign, sans-serif"78 leftRight_copy_fontsize = "35px"79 leftRight_copy_lineheight = "40px"80 leftRight_copy_spaceletter = "normal"81 if leftRight_copy_fontfamily != leftRight_copy.value_of_css_property('font-family'):82 print("Son distintos los font family copy LF")83 print(leftRight_copy.value_of_css_property('font-family'))84 leftRight_copy.screenshot("copyLR.png")85 if leftRight_copy_fontsize != leftRight_copy.value_of_css_property('font-size'):86 print("Son distintos los font size del copy LF")87 print(leftRight_copy.value_of_css_property('font-size'))88 leftRight_copy.screenshot("copyLR.png")89 if leftRight_copy_lineheight != leftRight_copy.value_of_css_property('line-height'):90 print("Son distintos los line height del copy LF")91 print(leftRight_copy.value_of_css_property('line-height'))92 leftRight_copy.screenshot("copyLR.png")93 if leftRight_copy_spaceletter != leftRight_copy.value_of_css_property('letter-spacing'):94 print("Es distinto el letter spacing del copy LF")95 print(leftRight_copy.value_of_css_property('letter-spacing'))96 leftRight_copy.screenshot("copyLF.png")97 images = self.driver.find_elements_by_tag_name('img')98 for img in images:99 dimensions = img.size100 width = dimensions['width']101 height = dimensions['height']102 print('{}x{}'.format(width, height))103 def test_footer(self):104 footer_linktext = self.driver.find_elements_by_id()105 footer_linktext_fontfamily = "Campaign, sans-serif"106 footer_linktext_fontsize = "14px"107 footer_linktext_lineheight = "22px"108 footer_linktext_spaceletter = "normal"109 if footer_linktext_fontfamily != footer_linktext.value_of_css_property('font-family'):110 print("Son distintos los font family linktext footer")111 print(footer_linktext.value_of_css_property('font-family'))112 footer_linktext.screenshot("linktext_footer.png")113 if footer_linktext_fontsize != footer_linktext.value_of_css_property('font-size'):114 print("Son distintos los font size del linktext footer")115 print(footer_linktext.value_of_css_property('font-size'))116 footer_linktext.screenshot("linktext_footer.png")117 if footer_linktext_lineheight != footer_linktext.value_of_css_property('line-height'):118 print("Son distintos los line height del linktext footer")119 print(footer_linktext.value_of_css_property('line-height'))120 footer_linktext.screenshot("linktext_footer.png")121 if footer_linktext_spaceletter != footer_linktext.value_of_css_property('letter-spacing'):122 print("Es distinto el letter spacing del linktext footer")123 print(footer_linktext.value_of_css_property('letter-spacing'))124 footer_linktext.screenshot("linktext_footer.png")125 footer_direcciones = self.driver.find_elements_by_id()126 footer_direcciones_fontfamily = "Campaign, sans-serif"127 footer_direcciones_fontsize = "10px"128 footer_direcciones_lineheight = "11px"129 footer_direcciones_spaceletter = "normal"130 if footer_direcciones_fontfamily != footer_direcciones.value_of_css_property('font-family'):131 print("Son distintos los font family footer direcciones")132 print(footer_direcciones.value_of_css_property('font-family'))133 footer_direcciones.screenshot("footer_direcciones.png")134 if footer_direcciones_fontsize != footer_direcciones.value_of_css_property('font-size'):135 print("Son distintos los font size del footer_direcciones")136 print(footer_direcciones.value_of_css_property('font-size'))137 footer_direcciones.screenshot("footer direcciones.png")138 if footer_direcciones_lineheight != footer_direcciones.value_of_css_property('line-height'):139 print("Son distintos los line height del footer_direcciones")140 print(footer_direcciones.value_of_css_property('line-height'))141 footer_direcciones.screenshot("footer_direcciones.png")142 if footer_direcciones_spaceletter != footer_direcciones.value_of_css_property('letter-spacing'):143 print("Es distinto el letter spacing del footer direcciones")144 print(footer_direcciones.value_of_css_property('letter-spacing'))145 footer_direcciones.screenshot("footer_direcciones.png")146 footer_copyright = self.driver.find_elements_by_id()147 footer_copyright_fontfamily = "Campaign, sans-serif"148 footer_copyright_fontsize = "10px"149 footer_copyright_lineheight = "11px"150 footer_copyright_spaceletter = "normal"151 if footer_copyright_fontfamily != footer_copyright.value_of_css_property('font-family'):152 print("Son distintos los font family copyright footer")153 print(footer_copyright.value_of_css_property('font-family'))154 footer_copyright.screenshot("copyright_footer.png")155 if footer_copyright_fontsize != footer_copyright.value_of_css_property('font-size'):156 print("Son distintos los font size del copyright footer")157 print(footer_copyright.value_of_css_property('font-size'))158 footer_copyright.screenshot("copyright_footer.png")159 if footer_copyright_lineheight != footer_copyright.value_of_css_property('line-height'):160 print("Son distintos los line height del copyright footer")161 print(footer_copyright.value_of_css_property('line-height'))162 footer_copyright.screenshot("copyright_footer.png")163 if footer_copyright_spaceletter != footer_copyright.value_of_css_property('letter-spacing'):164 print("Es distinto el letter spacing del copyright footer")165 print(footer_copyright.value_of_css_property('letter-spacing'))...
Excercise27.py
Source:Excercise27.py
...16#Identifying the nested frame 1 elements 17 frame1=driver.find_element(By.XPATH,"//div[@class='activity content']")18 button=driver.find_element(By.ID,"actionButton")19#Printing the attributes of the frame 1 & button 20 buttonColor=button.value_of_css_property("color")21 buttonBg=button.value_of_css_property("background-color")22 buttonText=button.text23 print(frame1.text)24 print(buttonColor)25 print(buttonBg)26 print(buttonText)27#Click the button in Frame 28 button.click()29#Printing the attributes of the frame 1 & button after clicking the button 30 buttonColor2=button.value_of_css_property("color")31 buttonBg2=button.value_of_css_property("background-color")32 buttonText2=button.text33 print(buttonColor2)34 print(buttonBg2)35 print(buttonText2)36#Switching to the parent frame 37 driver.switch_to.parent_frame()38#Switching to the Frame 2 39 driver.switch_to.frame(1)40#Identifying the nested frame 2 elements 41 button2=driver.find_element(By.ID,"actionButton")42 button2Color=button2.value_of_css_property("color")43 button2Bg=button2.value_of_css_property("background-color")44 buttonText=button2.text45#Printing the attributes of the frame 2 & button 46 print(button2Color)47 print(button2Bg)48 print(buttonText)49#Click the button in Frame 2 50 button2.click()51#Printing the attributes of the frame 2 & button after clicking the button 52 button2Color2=button2.value_of_css_property("color")53 button2Bg2=button2.value_of_css_property("background-color")54 buttonText2=button2.text55 print(button2Color2)56 print(button2Bg2)57 print(buttonText2)...
Excercise26.py
Source:Excercise26.py
...9 driver.switch_to.frame(0)10 frame1=driver.find_element(By.XPATH,"//div[@class='content']")11 print(frame1.text)12 button=driver.find_element(By.ID,"actionButton")13 buttonColor=button.value_of_css_property("color")14 buttonBg=button.value_of_css_property("background-color")15 buttonText=button.text16 print(buttonColor)17 print(buttonBg)18 print(buttonText)19 button.click()20 buttonColor2=button.value_of_css_property("color")21 buttonBg2=button.value_of_css_property("background-color")22 buttonText2=button.text23 print(buttonColor2)24 print(buttonBg2)25 print(buttonText2)26 driver.switch_to.default_content()27 driver.switch_to.frame(1)28 button2=driver.find_element(By.ID,"actionButton")29 button2Color=button2.value_of_css_property("color")30 button2Bg=button2.value_of_css_property("background-color")31 buttonText=button2.text32 print(button2Color)33 print(button2Bg)34 print(buttonText)35 button2.click()36 button2Color2=button2.value_of_css_property("color")37 button2Bg2=button2.value_of_css_property("background-color")38 buttonText2=button2.text39 print(button2Color2)40 print(button2Bg2)41 print(buttonText2)...
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!!