@@ -912,6 +912,12 @@ def send_keys(self, selector, text, timeout=None):
912912 element .scroll_into_view ()
913913 if text .endswith ("\n " ) or text .endswith ("\r " ):
914914 text = text [:- 1 ] + "\r \n "
915+ elif (
916+ element .tag_name == "textarea"
917+ and "\n " in text
918+ and "\r " not in text
919+ ):
920+ text = text .replace ("\n " , "\r " )
915921 element .send_keys (text )
916922 self .__slow_mode_pause_if_set ()
917923 self .loop .run_until_complete (self .page .sleep (0.025 ))
@@ -927,6 +933,12 @@ def press_keys(self, selector, text, timeout=None):
927933 if text .endswith ("\n " ) or text .endswith ("\r " ):
928934 submit = True
929935 text = text [:- 1 ]
936+ elif (
937+ element .tag_name == "textarea"
938+ and "\n " in text
939+ and "\r " not in text
940+ ):
941+ text = text .replace ("\n " , "\r " )
930942 for key in text :
931943 element .send_keys (key )
932944 time .sleep (0.044 )
@@ -947,6 +959,12 @@ def type(self, selector, text, timeout=None):
947959 element .clear_input ()
948960 if text .endswith ("\n " ) or text .endswith ("\r " ):
949961 text = text [:- 1 ] + "\r \n "
962+ elif (
963+ element .tag_name == "textarea"
964+ and "\n " in text
965+ and "\r " not in text
966+ ):
967+ text = text .replace ("\n " , "\r " )
950968 element .send_keys (text )
951969 self .__slow_mode_pause_if_set ()
952970 self .loop .run_until_complete (self .page .sleep (0.025 ))
@@ -1555,17 +1573,15 @@ def __install_pyautogui_if_missing(self):
15551573 import pyautogui
15561574 with suppress (Exception ):
15571575 use_pyautogui_ver = constants .PyAutoGUI .VER
1558- if pyautogui . __version__ != use_pyautogui_ver :
1559- del pyautogui
1560- shared_utils . pip_install (
1561- "pyautogui" , version = use_pyautogui_ver
1562- )
1576+ u_pv = shared_utils . make_version_tuple ( use_pyautogui_ver )
1577+ pv = shared_utils . make_version_tuple ( pyautogui . __version__ )
1578+ if pv < u_pv :
1579+ del pyautogui # To get newer ver
1580+ shared_utils . pip_install ( "pyautogui" , version = "Latest" )
15631581 import pyautogui
15641582 except Exception :
15651583 print ("\n PyAutoGUI required! Installing now..." )
1566- shared_utils .pip_install (
1567- "pyautogui" , version = constants .PyAutoGUI .VER
1568- )
1584+ shared_utils .pip_install ("pyautogui" , version = "Latest" )
15691585 try :
15701586 import pyautogui
15711587 except Exception :
0 commit comments