44
55class UserAgentTests (BaseCase ):
66 def test_user_agent (self ):
7- self .open ("https://www.whatsmyua.info/" )
8- self .highlight ("#rawUa" , loops = 2 )
9- user_agent_detected = self .get_text ("#rawUa" )
7+ self .open ("https://my-user-agent.com/" )
8+ zoom_in = "#ua_string{zoom: 1.8;-moz-transform: scale(1.8);}"
9+ self .add_css_style (zoom_in )
10+ self .highlight ("#ua_string" )
11+ user_agent_detected = self .get_text ("#ua_string" )
1012 original_user_agent = user_agent_detected
1113 if not self .user_agent :
1214 # Using the built-in user-agent string
@@ -15,7 +17,7 @@ def test_user_agent(self):
1517 # User-agent was overridden using: --agent=STRING
1618 print ("\n \n User-Agent override: %s" % user_agent_detected )
1719 if not (self .headless or self .headless2 or self .xvfb ):
18- self .sleep (3 )
20+ self .sleep (2.75 )
1921
2022 # Now change the user-agent using "execute_cdp_cmd()"
2123 if not self .is_chromium ():
@@ -33,12 +35,16 @@ def test_user_agent(self):
3335 "NF/6.0.1.15.4 NintendoBrowser/5.1.0.20393"
3436 },
3537 )
36- self .open ("https://www.whatsmyua.info/" )
37- self .highlight ("#rawUa" , loops = 2 )
38- user_agent_detected = self .get_text ("#rawUa" )
38+ self .open ("about:blank" )
39+ self .sleep (0.05 ) # Enough to see that the page was refreshed
40+ self .open ("https://my-user-agent.com/" )
41+ zoom_in = "#ua_string{zoom: 1.8;-moz-transform: scale(1.8);}"
42+ self .add_css_style (zoom_in )
43+ self .highlight ("#ua_string" )
44+ user_agent_detected = self .get_text ("#ua_string" )
3945 print ("\n User-Agent override: %s" % user_agent_detected )
4046 if not (self .headless or self .headless2 or self .xvfb ):
41- self .sleep (3 )
47+ self .sleep (2.75 )
4248 finally :
4349 # Reset the user-agent back to the original
4450 self .execute_cdp_cmd (
0 commit comments