@@ -31,8 +31,39 @@ def load_servers_page(self):
3131 def server_stmp_and_imap_add (self ):
3232 self .toggle_server_section ('server_config' )
3333 self .wait_on_class ('imap-jmap-smtp-btn' )
34- self .by_id ('add_new_server_button' ).click ()
35- # self.wait_on_class('srv_setup_stepper_profile_name')
34+
35+ # Wait for the add button to be clickable (combines presence and clickability)
36+ add_button = WebDriverWait (self .driver , 10 ).until (
37+ EC .element_to_be_clickable ((By .ID , "add_new_server_button" ))
38+ )
39+
40+ # Scroll the button into view before clicking
41+ self .driver .execute_script ("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center'});" , add_button )
42+ sleep (0.5 )
43+
44+ try :
45+ add_button .click ()
46+ print ("Normal click succeeded" )
47+ except Exception as e :
48+ print (f"Normal click failed: { e } . Trying JavaScript click..." )
49+ self .driver .execute_script ("arguments[0].click();" , add_button )
50+
51+ # Wait for the form to appear after clicking
52+ try :
53+ WebDriverWait (self .driver , 10 ).until (
54+ EC .any_of (
55+ EC .presence_of_element_located ((By .ID , 'srv_setup_stepper_profile_name' )),
56+ EC .presence_of_element_located ((By .NAME , 'srv_setup_stepper_profile_name' ))
57+ )
58+ )
59+ print ("Server setup form appeared" )
60+ except Exception as e :
61+ print (f"Server setup form did not appear: { e } " )
62+ # Debug: print current page state
63+ print ("Current URL:" , self .driver .current_url )
64+ print ("Page title:" , self .driver .title )
65+ raise e
66+
3667 name = self .by_id ('srv_setup_stepper_profile_name' )
3768 name .send_keys ('Test' )
3869 email = self .by_name ('srv_setup_stepper_email' )
0 commit comments