How to use is_displayed method in Selene

Best Python code snippet using selene_python

visibility_test.py

Source:visibility_test.py Github

copy

Full Screen

...7class NaturalNonVisibleElementsTest(base_test.WebDriverBaseTest):8 def test_0x0_pixel_element_is_not_visible(self):9 self.driver.get(self.webserver.where_is("element_state/res/0x0-pixels.html"))10 el = self.driver.find_element_by_css_selector("div")11 self.assertFalse(el.is_displayed())12 def test_0x0_pixel_text_node_is_visible(self):13 self.driver.get(self.webserver.where_is("element_state/res/0x0-pixels-text-node.html"))14 el = self.driver.find_element_by_css_selector("p")15 self.assertTrue(el.is_displayed())16 def test_1x1_pixel_element(self):17 self.driver.get(self.webserver.where_is("element_state/res/1x1-pixels.html"))18 el = self.driver.find_element_by_css_selector("p")19 self.assertTrue(el.is_displayed())20 def test_zero_sized_element_is_shown_if_decendant_has_size(self):21 self.driver.get(self.webserver.where_is("element_state/res/zero-sized-element-with-sizable-decendant.html"))22 parent = self.driver.find_element_by_css_selector("#parent")23 child = self.driver.find_element_by_css_selector("#child")24 self.assertTrue(parent.is_displayed())25 self.assertTrue(child.is_displayed())26 def test_input_type_hidden_is_never_visible(self):27 self.driver.get(self.webserver.where_is("element_state/res/input-type-hidden.html"))28 input = self.driver.find_element_by_css_selector("input")29 self.assertFalse(input.is_displayed())30 def test_input_morphs_into_hidden(self):31 self.driver.get(self.webserver.where_is("element_state/res/input-morphs-into-hidden.html"))32 input = self.driver.find_element_by_css_selector("input")33 self.assertFalse(input.is_displayed())34 def test_parent_node_visible_when_all_children_are_absolutely_positioned_and_overflow_is_hidden(self):35 pass36 def test_parent_of_absolutely_positioned_elements_visible_where_ancestor_overflow_is_hidden(self):37 """When a parent's ancestor hides any overflow, absolutely positioned child elements are38 still visible. The parent container is also considered visible by webdriver for this39 reason because it is interactable."""40 self.driver.get(self.webserver.where_is("element_state/res/absolute-children-ancestor-hidden-overflow.html"))41 children = self.driver.find_elements_by_css_selector(".child")42 assert all(child.is_displayed() for child in children)43 parent = self.driver.find_element_by_css_selector("#parent")44 assert parent.is_displayed()45 def test_element_hidden_by_overflow_x_is_not_visible(self):46 # TODO(andreastt): This test should probably be split in three. Also it's making two47 # assertions.48 pages = ["element_state/res/x-hidden-y-hidden.html",49 "element_state/res/x-hidden-y-scroll.html",50 "element_state/res/x-hidden-y-auto.html"]51 for page in pages:52 self.driver.get(self.webserver.where_is(page))53 right = self.driver.find_element_by_css_selector("#right")54 bottom_right = self.driver.find_element_by_css_selector("#bottom-right")55 self.assertFalse(right.is_displayed())56 self.assertFalse(bottom_right.is_displayed())57 def test_element_hidden_by_overflow_y_is_not_visible(self):58 # TODO(andreastt): This test should probably be split in three. Also it's making two59 # assertions.60 pages = ["element_state/res/x-hidden-y-hidden.html",61 "element_state/res/x-scroll-y-hidden.html",62 "element_state/res/x-auto-y-hidden.html"]63 for page in pages:64 self.driver.get(self.webserver.where_is(page))65 bottom = self.driver.find_element_by_css_selector("#bottom")66 bottom_right = self.driver.find_element_by_css_selector("#bottom-right")67 self.assertFalse(bottom.is_displayed())68 self.assertFalse(bottom_right.is_displayed())69 def test_parent_node_visible_when_all_children_are_absolutely_position_and_overflow_is_hidden(self):70 pass71 def test_element_scrollable_by_overflow_x_is_visible(self):72 pass73 def test_element_scrollable_by_overflow_y_is_visible(self):74 pass75 def test_element_scrollable_by_overflow_x_and_y_is_visible(self):76 pass77 def test_element_scrollable_by_overflow_y_is_visible(self):78 pass79 def test_element_outside_viewport(self):80 self.driver.get(self.webserver.where_is("element_state/res/element-outside-viewport.html"))81 hidden = self.driver.find_element_by_css_selector("div")82 self.assertFalse(hidden.is_displayed())83 def test_element_dynamically_moved_outside_viewport(self):84 self.driver.get(self.webserver.where_is("element_state/res/element-dynamically-moved-outside-viewport.html"))85 hidden = self.driver.find_element_by_css_selector("div")86 self.assertFalse(hidden.is_displayed())87 def test_element_hidden_by_other_element(self):88 self.driver.get(self.webserver.where_is("element_state/res/element-hidden-by-other-element.html"))89 overlay = self.driver.find_element_by_css_selector("#overlay")90 hidden = self.driver.find_element_by_css_selector("#hidden")91 self.assertTrue(overlay.is_displayed())92 self.assertFalse(hidden.is_displayed())93 def test_element_partially_hidden_by_other_element(self):94 self.driver.get(self.webserver.where_is("element_state/res/element-partially-hidden-by-other-element.html"))95 partial = self.driver.find_element_by_css_selector("#partial")96 self.assertTrue(partial.is_displayed())97 def test_element_hidden_by_z_index(self):98 self.driver.get(self.webserver.where_is("element_state/res/element-hidden-by-z-index.html"))99 overlay = self.driver.find_element_by_css_selector("#overlay")100 hidden = self.driver.find_element_by_css_selector("#hidden")101 self.assertTrue(overlay.is_displayed())102 self.assertFalse(hidden.is_displayed())103 def test_element_moved_outside_viewport_by_transform(self):104 self.driver.get(self.webserver.where_is("element_state/res/element-moved-outside-viewport-by-transform.html"))105 el = self.driver.find_element_by_css_selector("div")106 self.assertFalse(el.is_displayed())107 def test_element_moved_behind_other_element_by_transform(self):108 self.driver.get(self.webserver.where_is("element_state/res/element-moved-behind-other-element-by-transform.html"))109 overlay = self.driver.find_element_by_css_selector("#overlay")110 hidden = self.driver.find_element_by_css_selector("#hidden")111 self.assertTrue(overlay.is_displayed())112 self.assertFalse(hidden.is_displayed())113 def test_text_with_same_color_as_background(self):114 self.driver.get(self.webserver.where_is("element_state/res/text-with-same-color-as-background.html"))115 p = self.driver.find_element_by_css_selector("p")116 self.assertFalse(p.is_displayed())117 def test_text_with_same_color_as_parent_background(self):118 self.driver.get(self.webserver.where_is("element_state/res/text-with-same-color-as-parent-background.html"))119 p = self.driver.find_element_by_css_selector("p")120 self.assertFalse(p.is_displayed())121 def test_text_with_matching_color_and_background(self):122 self.driver.get(self.webserver.where_is("element_state/res/text-with-matching-color-and-background.html"))123 p = self.driver.find_element_by_css_selector("p")124 self.assertTrue(p.is_displayed())125 def test_element_with_same_color_as_background(self):126 self.driver.get(self.webserver.where_is("element_state/res/element-with-same-color-as-background.html"))127 el = self.driver.find_element_by_css_selector("div")128 self.assertFalse(el.is_displayed())129 def test_element_with_same_color_as_parent_background(self):130 self.driver.get(self.webserver.where_is("element_state/res/element-with-same-color-as-parent-background.html"))131 hidden = self.driver.find_element_by_css_selector("#hidden")132 self.assertFalse(hidden.is_displayed())133class BodyElementIsAlwaysDisplayedTest(base_test.WebDriverBaseTest):134 def assert_body_is_displayed_on(self, page):135 self.driver.get(self.webserver.where_is(page))136 body = self.driver.find_element_by_css_selector("body")137 assert body.is_displayed()138 def test_implicit(self):139 self.assert_body_is_displayed_on("element_state/res/body_implicit.html")140 def test_empty(self):141 self.assert_body_is_displayed_on("element_state/res/body_empty.html")142 def test_visibility_hidden(self):143 self.assert_body_is_displayed_on("element_state/res/body_visibility_hidden.html")144 def test_overflow_hidden(self):145 self.assert_body_is_displayed_on("element_state/res/body_overflow_hidden.html")146class DisplayTest(base_test.WebDriverBaseTest):147 def test_display_block(self):148 self.driver.get(self.webserver.where_is("element_state/res/display-block.html"))149 el = self.driver.find_element_by_css_selector("p")150 self.assertTrue(el.is_displayed())151 def test_display_none(self):152 self.driver.get(self.webserver.where_is("element_state/res/display-none.html"))153 el = self.driver.find_element_by_css_selector("p")154 self.assertFalse(el.is_displayed())155 def test_display_none_hides_child_node(self):156 self.driver.get(self.webserver.where_is("element_state/res/display-none-child.html"))157 parent = self.driver.find_element_by_css_selector("#parent")158 child = self.driver.find_element_by_css_selector("#child")159 self.assertFalse(parent.is_displayed())160 self.assertFalse(child.is_displayed())161 def test_display_none_hides_child_node_link(self):162 self.driver.get(self.webserver.where_is("element_state/res/display-none-child-link.html"))163 child = self.driver.find_element_by_css_selector("#child")164 self.assertFalse(child.is_displayed())165 def test_display_none_hides_child_node_paragraph(self):166 self.driver.get(self.webserver.where_is("element_state/res/display-none-child-paragraph.html"))167 child = self.driver.find_element_by_css_selector("#child")168 self.assertFalse(child.is_displayed())169 def test_display_none_on_parent_takes_presedence(self):170 self.driver.get(self.webserver.where_is("element_state/res/display-none-parent-presedence.html"))171 child = self.driver.find_element_by_css_selector("#child")172 self.assertFalse(child.is_displayed())173 def test_display_none_on_parent_takes_presedence_over_visibility_visible(self):174 self.driver.get(self.webserver.where_is("element_state/res/display-none-parent-presedence-visibility.html"))175 child = self.driver.find_element_by_css_selector("#child")176 self.assertFalse(child.is_displayed())177 def test_display_none_hidden_dynamically(self):178 self.driver.get(self.webserver.where_is("element_state/res/display-none-dynamic.html"))179 hidden = self.driver.find_element_by_css_selector("#hidden")180 self.assertFalse(hidden.is_displayed())181class VisibilityTest(base_test.WebDriverBaseTest):182 def test_element_state_hidden(self):183 self.driver.get(self.webserver.where_is("element_state/res/visibility-hidden.html"))184 el = self.driver.find_element_by_css_selector("p")185 self.assertFalse(el.is_displayed())186 def test_element_state_visible(self):187 self.driver.get(self.webserver.where_is("element_state/res/visibility-visible.html"))188 el = self.driver.find_element_by_css_selector("p")189 self.assertTrue(el.is_displayed())190 def test_visibility_hidden_hides_child_node(self):191 self.driver.get(self.webserver.where_is("element_state/res/visibility-child.html"))192 parent = self.driver.find_element_by_css_selector("#parent")193 child = self.driver.find_element_by_css_selector("#child")194 self.assertFalse(parent.is_displayed())195 self.assertFalse(child.is_displayed())196 def test_visibility_hidden_hides_child_node_link(self):197 self.driver.get(self.webserver.where_is("element_state/res/visibility-child-link.html"))198 parent = self.driver.find_element_by_css_selector("#parent")199 child = self.driver.find_element_by_css_selector("#child")200 self.assertFalse(parent.is_displayed())201 self.assertFalse(child.is_displayed())202 def test_visibility_hidden_hides_child_node_paragraph(self):203 self.driver.get(self.webserver.where_is("element_state/res/visibility-child-paragraph.html"))204 parent = self.driver.find_element_by_css_selector("#parent")205 child = self.driver.find_element_by_css_selector("#child")206 self.assertFalse(parent.is_displayed())207 self.assertFalse(child.is_displayed())208 def test_visibility_hidden_on_child_takes_precedence(self):209 self.driver.get(self.webserver.where_is("element_state/res/visibility-child-presedence.html"))210 child = self.driver.find_element_by_css_selector("#child")211 self.assertTrue(child.is_displayed())212 def test_visibility_hidden_on_parent_takes_precedence_over_display_block(self):213 pass214 def test_visibility_hidden_set_dynamically(self):215 pass216 def test_should_show_element_not_visible_with_hidden_attribute(self):217 self.driver.get(self.webserver.where_is("element_state/res/hidden.html"))218 singleHidden = self.driver.find_element_by_css_selector('#singleHidden')219 self.assertFalse(singleHidden.is_displayed())220 def test_should_show_element_not_visible_when_parent_element_has_hidden_attribute(self):221 self.driver.get(self.webserver.where_is("element_state/res/hidden.html"))222 child = self.driver.find_element_by_css_selector('#child')223 self.assertFalse(child.is_displayed())224class VisibilityInteractionTest(base_test.WebDriverBaseTest):225 def test_input_hidden_is_unclickable(self):226 self.driver.get(self.webserver.where_is("element_state/res/input-type-hidden-unclickable.html"))227 input = self.driver.find_element_by_css_selector("input")228 with self.assertRaises(exceptions.ElementNotVisibleException):229 input.click()230 def test_hidden_input_checkbox_is_untogglable(self):231 self.driver.get(self.webserver.where_is("element_state/res/hidden-input-type-checkbox-untogglable.html"))232 checkbox = self.driver.find_element_by_css_selector("input")233 with self.assertRaises(exceptions.ElementNotVisibleException):234 checkbox.click()235 def test_typing_in_hidden_input_is_impossible(self):236 self.driver.get(self.webserver.where_is("element_state/res/hidden-input-type-text-writing.html"))237 textfield = self.driver.find_element_by_css_selector("input")...

Full Screen

Full Screen

pages.py

Source:pages.py Github

copy

Full Screen

...10class Aussortieren_1(Page):11 form_model = "player"12 form_fields = ["sound_image_check"]13class fail(Page):14 def is_displayed(self):15 return self.player.sound_image_check!=3 16class Aussortieren_2(Page):17 form_model = "player"18 form_fields = ["NPV", "tabNPV", "time_Aussortieren2"]19class fail2(Page):20 def is_displayed(self):21 return self.player.NPV!=4 22class wel_ins2(Page):23 form_model = "player"24 form_fields = ["time_wel_ins2"]25 26class Comprehension(Page):27 form_model = "player"28 form_fields = ["compensation","independency","procedure", "time_Comprehension"]29 def compensation_error_message(self,value):30 if value!=2:31 return "Your answer is not correct. Please read the experiment instructions again."32 def independency_error_message(self,value):33 if value!=1:34 return "Your answer is not correct. Please read the experiment instructions again."35 def procedure_error_message(self,value):36 if value!=2:37 return "Your answer is not correct. Please read the experiment instructions again."38class PEQ_vortrain(Page):39 form_model = "player"40 form_fields = ["Mood", "DuCha_1", "Estima", "Analy"] 41class Lottery_ins(Page):42 form_model = "player"43 form_fields = ["time_Lottery_ins"]44class Lottery(Page):45 form_model = "player"46 form_fields = ["lottery_choice", "time_Lottery"]47 def vars_for_template(self): #to create risk lottery bootstrap table48 list1 = Constants.lottery_gamble_successrate49 list2 = Constants.lottery_gamble_failurerate50 list3 = [f"id_lottery_choice_{i}" for i in range(1,17)] #1 to 16, 16th in case someone always wants to gamble51 data = list(zip(list1,list2,list3))52 return {"data": data} # {% for a,b,c in data %} -> {{ a }} .. .. -> displays 85% .. 15% .. form.lottery_choice.053 def before_next_page(self):54 self.participant.vars["global_lottery_choice"] = self.player.lottery_choice #if payout is needed in another app55 print("global_lottery_choice" + str(self.participant.vars["global_lottery_choice"]))56class train_ov(Page):57 form_model = "player"58class VT_sec_1(Page):59 def is_displayed(self):60 return self.subsession.training == "VT" #page is only displayed on VT condition61 62 form_model = "player"63 form_fields = ["tabVT1"]64class TT_sec_1(Page):65 form_model = "player"66 form_fields = ["time_TT_sec_1"]67 def is_displayed(self):68 return self.subsession.training == "TT" #page is only displayed on VT condition69class UV_sec_1(Page):70 form_model = "player"71 form_fields = ["tabUV1"]72 73 def is_displayed(self):74 return self.subsession.training == "UT" #page is only displayed on UT condition75 76class T_sec_1_ques1(Page):77 def is_displayed(self):78 return self.subsession.training != "UT"79 form_model = "player"80 form_fields = ["qBiasknowledge2", "qBiasknowledge3"]81class T_sec_1_ques1_fn(Page):82 def is_displayed(self):83 return self.player.qBiasknowledge2!=1 and self.subsession.training != "UT"84class T_sec_1_ques1_fp(Page):85 def is_displayed(self):86 return self.player.qBiasknowledge2!=2 and self.subsession.training != "UT"87class UV_sec_1_ques1(Page):88 form_model = "player"89 form_fields = ["qsustaininvest2", "qsustaininvest3"]90 def is_displayed(self):91 return self.subsession.training == "UT"92class UV_sec_1_ques1_fn(Page):93 def is_displayed(self):94 return self.player.qsustaininvest2!=1 and (self.subsession.training == "UT")95class UV_sec_1_ques1_fp(Page):96 def is_displayed(self):97 return self.player.qsustaininvest2!=2 and (self.subsession.training == "UT")98class VT_sec_2(Page):99 form_model = "player"100 form_fields = ["tabVT2"]101 def is_displayed(self):102 return self.subsession.training == "VT"103class TT_sec_2_1(Page):104 form_model = "player"105 form_fields = ["time_TT_sec_2_1", "tabTTsec21"]106 def is_displayed(self):107 return self.subsession.training == "TT"108class TT_sec_2_2(Page):109 form_model = "player"110 form_fields = ["time_TT_sec_2_2", "tabTTsec22"]111 def is_displayed(self):112 return self.subsession.training == "TT"113class UV_sec_2(Page):114 form_model = "player"115 form_fields = ["tabUV2"]116 def is_displayed(self):117 return self.subsession.training == "UT"118class T_sec_2_ques1(Page):119 form_model = "player"120 form_fields = ["Tsec2_quest1"]121 def is_displayed(self):122 return self.subsession.training != "UT"123class T_sec_2_ques1_fp(Page):124 def is_displayed(self):125 return self.player.Tsec2_quest1==2 and self.subsession.training != "UT"126class T_sec_2_ques1_fn(Page):127 def is_displayed(self):128 return self.player.Tsec2_quest1!=2 and self.subsession.training != "UT"129class T_sec_2_ques2(Page):130 form_model = "player"131 form_fields = ["Tsec2_quest2"]132 def is_displayed(self):133 return self.subsession.training != "UT"134class T_sec_2_ques2_fp(Page):135 def is_displayed(self):136 return self.player.Tsec2_quest2==3 and self.subsession.training != "UT"137class T_sec_2_ques2_fn(Page):138 def is_displayed(self):139 return self.player.Tsec2_quest2!=3 and self.subsession.training != "UT"140class UV_sec_2_ques1(Page):141 form_model = "player"142 form_fields = ["UVsec2_quest1"]143 def is_displayed(self):144 return self.subsession.training == "UT"145class UV_sec_2_ques1_fn(Page):146 def is_displayed(self):147 return self.player.UVsec2_quest1!=3 and (self.subsession.training == "UT")148class UV_sec_2_ques1_fp(Page):149 def is_displayed(self):150 return self.player.UVsec2_quest1==3 and (self.subsession.training == "UT")151class UV_sec_2_ques2(Page):152 form_model = "player"153 form_fields = ["UVsec2_quest2"]154 def is_displayed(self):155 return self.subsession.training == "UT"156class UV_sec_2_ques2_fn(Page):157 def is_displayed(self):158 return self.player.UVsec2_quest2!=1 and (self.subsession.training == "UT")159class UV_sec_2_ques2_fp(Page):160 def is_displayed(self):161 return self.player.UVsec2_quest2==1 and (self.subsession.training == "UT")162class VT_sec_3(Page):163 form_model = "player"164 form_fields = ["tabVT3"]165 def is_displayed(self):166 return self.subsession.training == "VT"167class TT_sec_3_1(Page):168 form_model = "player"169 form_fields = ["time_TT_sec_3_1", "tabTTsec31"]170 def is_displayed(self):171 return self.subsession.training == "TT"172class TT_sec_3_2(Page):173 form_model = "player"174 form_fields = ["time_TT_sec_3_2", "tabTTsec32"]175 def is_displayed(self):176 return self.subsession.training == "TT"177class UV_sec_3(Page):178 # def is_displayed(self):179 # return self.player.treatment == 3 or 6180 form_model = "player"181 form_fields = ["tabUV3"]182 def is_displayed(self):183 return self.subsession.training == "UT"184class T_sec_3_ques1(Page):185 form_model = "player"186 form_fields = ["Tsec3_quest1"]187 def is_displayed(self):188 return self.subsession.training != "UT"189class T_sec_3_ques1_fn(Page):190 def is_displayed(self):191 return self.player.Tsec3_quest1!=2 and self.subsession.training != "UT"192class T_sec_3_ques1_fp(Page):193 def is_displayed(self):194 return self.player.Tsec3_quest1==2 and self.subsession.training != "UT"195class T_sec_3_ques2(Page):196 form_model = "player"197 form_fields = ["Tsec3_quest2"] 198 def is_displayed(self):199 return self.subsession.training != "UT"200class T_sec_3_ques2_fn(Page):201 def is_displayed(self):202 return self.player.Tsec3_quest2!=2 and self.subsession.training != "UT"203class T_sec_3_ques2_fp(Page):204 def is_displayed(self):205 return self.player.Tsec3_quest2==2 and self.subsession.training != "UT"206class T_sec_3_ques3(Page):207 form_model = "player"208 form_fields = ["Tsec3_quest3"]209 def is_displayed(self):210 return self.subsession.training != "UT"211class T_sec_3_ques3_fn(Page):212 def is_displayed(self):213 return self.player.Tsec3_quest3!=2 and self.subsession.training != "UT"214class T_sec_3_ques3_fp(Page):215 def is_displayed(self):216 return self.player.Tsec3_quest3==2 and self.subsession.training != "UT"217class UV_sec_3_ques1(Page):218 form_model = "player"219 form_fields = ["UVsec3_quest1"]220 def is_displayed(self):221 return self.subsession.training == "UT"222class UV_sec_3_ques1_fn(Page):223 def is_displayed(self):224 return self.player.UVsec3_quest1!=2 and (self.subsession.training == "UT")225class UV_sec_3_ques1_fp(Page):226 def is_displayed(self):227 return self.player.UVsec3_quest1==2 and (self.subsession.training == "UT")228class UV_sec_3_ques2(Page):229 form_model = "player"230 form_fields = ["UVsec3_quest2"]231 def is_displayed(self):232 return self.subsession.training == "UT"233class UV_sec_3_ques2_fn(Page):234 def is_displayed(self):235 return self.player.UVsec3_quest2!=2 and (self.subsession.training == "UT")236class UV_sec_3_ques2_fp(Page):237 def is_displayed(self):238 return self.player.UVsec3_quest2==2 and (self.subsession.training == "UT")239class UV_sec_3_ques3(Page):240 form_model = "player"241 form_fields = ["UVsec3_quest3"]242 def is_displayed(self):243 return self.subsession.training == "UT"244class UV_sec_3_ques3_fn(Page):245 def is_displayed(self):246 return self.player.UVsec3_quest3!=2 and (self.subsession.training == "UT")247class UV_sec_3_ques3_fp(Page):248 def is_displayed(self):249 return self.player.UVsec3_quest3==2 and (self.subsession.training == "UT")250class VT_sec_4(Page):251 form_model = "player"252 form_fields = ["tabVT4"]253 def is_displayed(self):254 return self.subsession.training == "VT"255class TT_sec_4(Page):256 form_model = "player"257 form_fields = ["time_TT_sec_4", "tabTTsec4"]258 def is_displayed(self):259 return self.subsession.training == "TT"260class UV_sec_4(Page):261 form_model = "player"262 form_fields = ["tabUV4"]263 def is_displayed(self):264 return self.subsession.training == "UT"265class PEQ_trainVT(Page):266 form_model = "player"267 form_fields = ["Intr_Mot1VT", "Intr_Mot2VT", "Mod1", "Mod2", "Pace","Cogn_Lo1", "Cogn_Lo2", "Cogn_Lo3", "Cogn_Lo4", "Ment_Eff", "Train_ManCheckVT"]268 def is_displayed(self):269 return self.subsession.training == "VT"270class PEQ_trainTT(Page):271 form_model = "player"272 form_fields = ["Intr_Mot1TT", "Intr_Mot2TT", "Mod1", "Mod2", "Pace", "Cogn_Lo1", "Cogn_Lo2", "Cogn_Lo3", "Cogn_Lo4", "Ment_Eff", "Train_ManCheckTT"]273 def is_displayed(self):274 return self.subsession.training == "TT"275class PEQ_trainUT(Page):276 form_model = "player"277 form_fields = ["Intr_Mot1VT", "Intr_Mot2VT", "Mod1", "Mod2", "Pace", "Cogn_Lo1", "Cogn_Lo2", "Cogn_Lo3", "Cogn_Lo4", "Ment_Eff", "Train_ManCheckUT", "Mood"]278 def is_displayed(self):279 return self.subsession.training == "UT"280class AC_no(Page):281 form_model = "player"282 def is_displayed(self):283 return self.subsession.accountability == "niedrig"284 def before_next_page(self):285 self.player.get_time("end")286 self.player.time_spent()287class AC_yes(Page):288 form_model = "player"289 form_fields = ["time_ACyes"]290 def before_next_page(self):291 self.player.get_time("end")292 self.player.time_spent()293 def is_displayed(self):294 return self.subsession.accountability == "hoch"...

Full Screen

Full Screen

test_visibility.py

Source:test_visibility.py Github

copy

Full Screen

2class TestVisibility(MarionetteTestCase):3 def testShouldAllowTheUserToTellIfAnElementIsDisplayedOrNot(self):4 test_html = self.marionette.absolute_url("javascriptPage.html")5 self.marionette.navigate(test_html)6 self.assertTrue(self.marionette.find_element('id', "displayed").is_displayed())7 self.assertFalse(self.marionette.find_element('id', "none").is_displayed())8 self.assertFalse(self.marionette.find_element('id',9 "suppressedParagraph").is_displayed())10 self.assertFalse(self.marionette.find_element('id', "hidden").is_displayed())11 def testVisibilityShouldTakeIntoAccountParentVisibility(self):12 test_html = self.marionette.absolute_url("javascriptPage.html")13 self.marionette.navigate(test_html)14 childDiv = self.marionette.find_element('id', "hiddenchild")15 hiddenLink = self.marionette.find_element('id', "hiddenlink")16 self.assertFalse(childDiv.is_displayed())17 self.assertFalse(hiddenLink.is_displayed())18 def testShouldCountElementsAsVisibleIfStylePropertyHasBeenSet(self):19 test_html = self.marionette.absolute_url("javascriptPage.html")20 self.marionette.navigate(test_html)21 shown = self.marionette.find_element('id', "visibleSubElement")22 self.assertTrue(shown.is_displayed())23 def testShouldModifyTheVisibilityOfAnElementDynamically(self):24 test_html = self.marionette.absolute_url("javascriptPage.html")25 self.marionette.navigate(test_html)26 element = self.marionette.find_element('id', "hideMe")27 self.assertTrue(element.is_displayed())28 element.click()29 self.assertFalse(element.is_displayed())30 def testHiddenInputElementsAreNeverVisible(self):31 test_html = self.marionette.absolute_url("javascriptPage.html")32 self.marionette.navigate(test_html)33 shown = self.marionette.find_element('name', "hidden")34 self.assertFalse(shown.is_displayed())35 def testShouldSayElementsWithNegativeTransformAreNotDisplayed(self):36 test_html = self.marionette.absolute_url("cssTransform.html")37 self.marionette.navigate(test_html)38 elementX = self.marionette.find_element("id", 'parentX')39 self.assertFalse(elementX.is_displayed())40 elementY = self.marionette.find_element("id", 'parentY')41 self.assertFalse(elementY.is_displayed())42 def testShouldSayElementsWithParentWithNegativeTransformAreNotDisplayed(self):43 test_html = self.marionette.absolute_url("cssTransform.html")44 self.marionette.navigate(test_html)45 elementX = self.marionette.find_element("id", 'childX')46 self.assertFalse(elementX.is_displayed())47 elementY = self.marionette.find_element("id", 'childY')48 self.assertFalse(elementY.is_displayed())49 def testShouldSayElementWithZeroTransformIsVisible(self):50 test_html = self.marionette.absolute_url("cssTransform.html")51 self.marionette.navigate(test_html)52 zero_tranform = self.marionette.find_element("id", 'zero-tranform')53 self.assertTrue(zero_tranform.is_displayed())54 def testShouldSayElementIsVisibleWhenItHasNegativeTransformButElementisntInANegativeSpace(self):55 test_html = self.marionette.absolute_url("cssTransform2.html")56 self.marionette.navigate(test_html)57 negative_percent__tranform = self.marionette.find_element("id", 'negative-percentage-transformY')58 self.assertTrue(negative_percent__tranform.is_displayed())59 def testShouldSayElementIsInvisibleWhenOverflowXIsHiddenAndOutOfViewport(self):60 test_html = self.marionette.absolute_url("bug814037.html")61 self.marionette.navigate(test_html)62 overflow_x = self.marionette.find_element("id", "assertMe2")63 self.assertFalse(overflow_x.is_displayed())64 def testShouldShowElementNotVisibleWithHiddenAttribute(self):65 test_html = self.marionette.absolute_url("hidden.html")66 self.marionette.navigate(test_html)67 singleHidden = self.marionette.find_element('id', 'singleHidden')68 self.assertFalse(singleHidden.is_displayed())69 def testShouldShowElementNotVisibleWhenParentElementHasHiddenAttribute(self):70 test_html = self.marionette.absolute_url("hidden.html")71 self.marionette.navigate(test_html)72 child = self.marionette.find_element('id', 'child')73 self.assertFalse(child.is_displayed())74 def testShouldClickOnELementPartiallyOffLeft(self):75 test_html = self.marionette.absolute_url("element_left.html")76 self.marionette.navigate(test_html)77 self.marionette.find_element('css selector', '.element').click()78 def testShouldClickOnELementPartiallyOffRight(self):79 test_html = self.marionette.absolute_url("element_right.html")80 self.marionette.navigate(test_html)81 self.marionette.find_element('css selector', '.element').click()82 def testShouldClickOnELementPartiallyOffTop(self):83 test_html = self.marionette.absolute_url("element_top.html")84 self.marionette.navigate(test_html)85 self.marionette.find_element('css selector', '.element').click()86 def testShouldClickOnELementPartiallyOffBottom(self):87 test_html = self.marionette.absolute_url("element_bottom.html")...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Selene automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful