@@ -672,6 +672,24 @@ async def get_navigation_history(self):
672672 """Get Navigation History"""
673673 return await self .send (cdp .page .get_navigation_history ())
674674
675+ async def get_user_agent (self ):
676+ """Get User Agent String"""
677+ return await self .evaluate ("navigator.userAgent" )
678+
679+ async def get_cookie_string (self ):
680+ """Get Cookie String"""
681+ return await self .evaluate ("document.cookie" )
682+
683+ async def get_locale_code (self ):
684+ """Get Locale Code"""
685+ return await self .evaluate (
686+ "navigator.language || navigator.languages[0]"
687+ )
688+
689+ async def is_online (self ):
690+ """Determine if connected to the Internet"""
691+ return await self .evaluate ("navigator.onLine" )
692+
675693 async def reload (
676694 self ,
677695 ignore_cache : Optional [bool ] = True ,
@@ -1577,6 +1595,9 @@ async def get_title(self):
15771595 async def get_current_url (self ):
15781596 return await self .evaluate ("window.location.href" )
15791597
1598+ async def get_origin (self ):
1599+ return await self .evaluate ("window.location.origin" )
1600+
15801601 async def send_keys (self , selector , text , timeout = 5 ):
15811602 element = await self .find (selector , timeout = timeout )
15821603 await element .send_keys_async (text )
@@ -1669,10 +1690,12 @@ async def solve_captcha(self):
16691690 ):
16701691 selector = '[data-callback="onCaptchaSuccess"]'
16711692 elif await self .is_element_present (
1672- "div:not([class]):not([id]) > div:not([class]):not([id])"
1693+ "div:not([class]):not([id]):not([aria-label]) > "
1694+ "div:not([class]):not([id]):not([aria-label])"
16731695 ):
16741696 selector = (
1675- "div:not([class]):not([id]) > div:not([class]):not([id])"
1697+ "div:not([class]):not([id]):not([aria-label]) > "
1698+ "div:not([class]):not([id]):not([aria-label])"
16761699 )
16771700 else :
16781701 return False
@@ -1761,7 +1784,7 @@ async def solve_captcha(self):
17611784 element_rect = await self .get_gui_element_rect (selector , timeout = 1 )
17621785 e_x = element_rect ["x" ]
17631786 e_y = element_rect ["y" ]
1764- x_offset = 32
1787+ x_offset = 28
17651788 y_offset = 32
17661789 if await asyncio .to_thread (shared_utils .is_windows ):
17671790 y_offset = 28
0 commit comments