Best Python code snippet using pyatom_python
text.py
Source:text.py  
1# Copyright (c) 2017 VMware, Inc; AO Kaspersky Lab. All Rights Reserved.2# This file is part of ATOMac.3# @author: Nagappan Alagappan <nagappan@gmail.com>4# @copyright: Copyright (c) 2009-12 Nagappan Alagappan5# http://ldtp.freedesktop.org6# ATOMac is free software; you can redistribute it and/or modify7# it under the terms of the GNU General Public License as published by the Free8# Software Foundation version 2 and no later version.9# ATOMac is distributed in the hope that it will be useful, but10# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 212# for more details.13# You should have received a copy of the GNU General Public License along with14# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin15# St, Fifth Floor, Boston, MA 02110-1301 USA.16"""Text class."""17import re18import fnmatch19import atomac.Clipboard as Clipboard20from .utils import Utils21from .keypress_actions import KeyComboAction, KeyPressAction, KeyReleaseAction22from .server_exception import LdtpServerException23class Text(Utils):24    def generatekeyevent(self, data):25        """26        Generates key event to the system, this simulates the best user like27        interaction via keyboard.28        29        @param data: data to type.30        @type data: string31        @return: 1 on success.32        @rtype: integer33        """34        KeyComboAction(data)35        return 136    def keypress(self, data):37        """38        Press key. NOTE: keyrelease should be called39        @param data: data to type.40        @type data: string41        @return: 1 on success.42        @rtype: integer43        """44        try:45            window = self._get_front_most_window()46        except (IndexError,):47            window = self._get_any_window()48        key_press_action = KeyPressAction(window, data)49        return 150    def keyrelease(self, data):51        """52        Release key. NOTE: keypress should be called before this53        @param data: data to type.54        @type data: string55        @return: 1 on success.56        @rtype: integer57        """58        try:59            window = self._get_front_most_window()60        except (IndexError,):61            window = self._get_any_window()62        key_release_action = KeyReleaseAction(window, data)63        return 164    def enterstring(self, window_name, object_name='', data=''):65        """66        Type string sequence.67        68        @param window_name: Window name to focus on, either full name,69        LDTP's name convention, or a Unix glob.70        @type window_name: string71        @param object_name: Object name to focus on, either full name,72        LDTP's name convention, or a Unix glob. 73        @type object_name: string74        @param data: data to type.75        @type data: string76        @return: 1 on success.77        @rtype: integer78        """79        if not object_name and not data:80            return self.generatekeyevent(window_name)81        else:82            object_handle = self._get_object_handle(window_name, object_name)83            if not object_handle.AXEnabled:84                raise LdtpServerException(u"Object %s state disabled" % object_name)85            self._grabfocus(object_handle)86            object_handle.sendKeys(data)87            return 188    def settextvalue(self, window_name, object_name, data):89        """90        Type string sequence.91        92        @param window_name: Window name to type in, either full name,93        LDTP's name convention, or a Unix glob.94        @type window_name: string95        @param object_name: Object name to type in, either full name,96        LDTP's name convention, or a Unix glob. 97        @type object_name: string98        @param data: data to type.99        @type data: string100        @return: 1 on success.101        @rtype: integer102        """103        object_handle = self._get_object_handle(window_name, object_name)104        if not object_handle.AXEnabled:105            raise LdtpServerException(u"Object %s state disabled" % object_name)106        object_handle.AXValue = data107        return 1108    def gettextvalue(self, window_name, object_name, startPosition=0, endPosition=0):109        """110        Get text value111        112        @param window_name: Window name to type in, either full name,113        LDTP's name convention, or a Unix glob.114        @type window_name: string115        @param object_name: Object name to type in, either full name,116        LDTP's name convention, or a Unix glob. 117        @type object_name: string118        @param startPosition: Starting position of text to fetch119        @type: startPosition: int120        @param endPosition: Ending position of text to fetch121        @type: endPosition: int122        @return: text on success.123        @rtype: string124        """125        object_handle = self._get_object_handle(window_name, object_name)126        if not object_handle.AXEnabled:127            raise LdtpServerException(u"Object %s state disabled" % object_name)128        return object_handle.AXValue129    def inserttext(self, window_name, object_name, position, data):130        """131        Insert string sequence in given position.132        133        @param window_name: Window name to type in, either full name,134        LDTP's name convention, or a Unix glob.135        @type window_name: string136        @param object_name: Object name to type in, either full name,137        LDTP's name convention, or a Unix glob. 138        @type object_name: string139        @param position: position where text has to be entered.140        @type data: int141        @param data: data to type.142        @type data: string143        @return: 1 on success.144        @rtype: integer145        """146        object_handle = self._get_object_handle(window_name, object_name)147        if not object_handle.AXEnabled:148            raise LdtpServerException(u"Object %s state disabled" % object_name)149        existing_data = object_handle.AXValue150        size = len(existing_data)151        if position < 0:152            position = 0153        if position > size:154            position = size155        object_handle.AXValue = existing_data[:position] + data + \156                                existing_data[position:]157        return 1158    def verifypartialmatch(self, window_name, object_name, partial_text):159        """160        Verify partial text161        162        @param window_name: Window name to type in, either full name,163        LDTP's name convention, or a Unix glob.164        @type window_name: string165        @param object_name: Object name to type in, either full name,166        LDTP's name convention, or a Unix glob. 167        @type object_name: string168        @param partial_text: Partial text to match169        @type object_name: string170        @return: 1 on success.171        @rtype: integer172        """173        try:174            if re.search(fnmatch.translate(partial_text),175                         self.gettextvalue(window_name,176                                           object_name)):177                return 1178        except:179            pass180        return 0181    def verifysettext(self, window_name, object_name, text):182        """183        Verify text is set correctly184        185        @param window_name: Window name to type in, either full name,186        LDTP's name convention, or a Unix glob.187        @type window_name: string188        @param object_name: Object name to type in, either full name,189        LDTP's name convention, or a Unix glob. 190        @type object_name: string191        @param text: text to match192        @type object_name: string193        @return: 1 on success.194        @rtype: integer195        """196        try:197            return int(re.match(fnmatch.translate(text),198                                self.gettextvalue(window_name,199                                                  object_name)))200        except:201            return 0202    def istextstateenabled(self, window_name, object_name):203        """204        Verifies text state enabled or not205        206        @param window_name: Window name to type in, either full name,207        LDTP's name convention, or a Unix glob.208        @type window_name: string209        @param object_name: Object name to type in, either full name,210        LDTP's name convention, or a Unix glob. 211        @type object_name: string212        @return: 1 on success 0 on failure.213        @rtype: integer214        """215        try:216            object_handle = self._get_object_handle(window_name, object_name)217            if object_handle.AXEnabled:218                return 1219        except LdtpServerException:220            pass221        return 0222    def getcharcount(self, window_name, object_name):223        """224        Get character count225        226        @param window_name: Window name to type in, either full name,227        LDTP's name convention, or a Unix glob.228        @type window_name: string229        @param object_name: Object name to type in, either full name,230        LDTP's name convention, or a Unix glob. 231        @type object_name: string232        @return: 1 on success.233        @rtype: integer234        """235        object_handle = self._get_object_handle(window_name, object_name)236        if not object_handle.AXEnabled:237            raise LdtpServerException(u"Object %s state disabled" % object_name)238        return object_handle.AXNumberOfCharacters239    def appendtext(self, window_name, object_name, data):240        """241        Append string sequence.242        243        @param window_name: Window name to type in, either full name,244        LDTP's name convention, or a Unix glob.245        @type window_name: string246        @param object_name: Object name to type in, either full name,247        LDTP's name convention, or a Unix glob. 248        @type object_name: string249        @param data: data to type.250        @type data: string251        @return: 1 on success.252        @rtype: integer253        """254        object_handle = self._get_object_handle(window_name, object_name)255        if not object_handle.AXEnabled:256            raise LdtpServerException(u"Object %s state disabled" % object_name)257        object_handle.AXValue += data258        return 1259    def getcursorposition(self, window_name, object_name):260        """261        Get cursor position262        263        @param window_name: Window name to type in, either full name,264        LDTP's name convention, or a Unix glob.265        @type window_name: string266        @param object_name: Object name to type in, either full name,267        LDTP's name convention, or a Unix glob. 268        @type object_name: string269        @return: Cursor position on success.270        @rtype: integer271        """272        object_handle = self._get_object_handle(window_name, object_name)273        if not object_handle.AXEnabled:274            raise LdtpServerException(u"Object %s state disabled" % object_name)275        return object_handle.AXSelectedTextRange.loc276    def setcursorposition(self, window_name, object_name, cursor_position):277        """278        Set cursor position279        280        @param window_name: Window name to type in, either full name,281        LDTP's name convention, or a Unix glob.282        @type window_name: string283        @param object_name: Object name to type in, either full name,284        LDTP's name convention, or a Unix glob. 285        @type object_name: string286        @param cursor_position: Cursor position to be set287        @type object_name: string288        @return: 1 on success.289        @rtype: integer290        """291        object_handle = self._get_object_handle(window_name, object_name)292        if not object_handle.AXEnabled:293            raise LdtpServerException(u"Object %s state disabled" % object_name)294        object_handle.AXSelectedTextRange.loc = cursor_position295        return 1296    def cuttext(self, window_name, object_name, start_position, end_position=-1):297        """298        cut text from start position to end position299        300        @param window_name: Window name to type in, either full name,301        LDTP's name convention, or a Unix glob.302        @type window_name: string303        @param object_name: Object name to type in, either full name,304        LDTP's name convention, or a Unix glob. 305        @type object_name: string306        @param start_position: Start position307        @type object_name: integer308        @param end_position: End position, default -1309        Cut all the text from start position till end310        @type object_name: integer311        @return: 1 on success.312        @rtype: integer313        """314        object_handle = self._get_object_handle(window_name, object_name)315        if not object_handle.AXEnabled:316            raise LdtpServerException(u"Object %s state disabled" % object_name)317        size = object_handle.AXNumberOfCharacters318        if end_position == -1 or end_position > size:319            end_position = size320        if start_position < 0:321            start_position = 0322        data = object_handle.AXValue323        Clipboard.copy(data[start_position:end_position])324        object_handle.AXValue = data[:start_position] + data[end_position:]325        return 1326    def copytext(self, window_name, object_name, start_position, end_position=-1):327        """328        copy text from start position to end position329        330        @param window_name: Window name to type in, either full name,331        LDTP's name convention, or a Unix glob.332        @type window_name: string333        @param object_name: Object name to type in, either full name,334        LDTP's name convention, or a Unix glob. 335        @type object_name: string336        @param start_position: Start position337        @type object_name: integer338        @param end_position: End position, default -1339        Copy all the text from start position till end340        @type object_name: integer341        @return: 1 on success.342        @rtype: integer343        """344        object_handle = self._get_object_handle(window_name, object_name)345        if not object_handle.AXEnabled:346            raise LdtpServerException(u"Object %s state disabled" % object_name)347        size = object_handle.AXNumberOfCharacters348        if end_position == -1 or end_position > size:349            end_position = size350        if start_position < 0:351            start_position = 0352        data = object_handle.AXValue353        Clipboard.copy(data[start_position:end_position])354        return 1355    def deletetext(self, window_name, object_name, start_position, end_position=-1):356        """357        delete text from start position to end position358        359        @param window_name: Window name to type in, either full name,360        LDTP's name convention, or a Unix glob.361        @type window_name: string362        @param object_name: Object name to type in, either full name,363        LDTP's name convention, or a Unix glob. 364        @type object_name: string365        @param start_position: Start position366        @type object_name: integer367        @param end_position: End position, default -1368        Delete all the text from start position till end369        @type object_name: integer370        @return: 1 on success.371        @rtype: integer372        """373        object_handle = self._get_object_handle(window_name, object_name)374        if not object_handle.AXEnabled:375            raise LdtpServerException(u"Object %s state disabled" % object_name)376        size = object_handle.AXNumberOfCharacters377        if end_position == -1 or end_position > size:378            end_position = size379        if start_position < 0:380            start_position = 0381        data = object_handle.AXValue382        object_handle.AXValue = data[:start_position] + data[end_position:]383        return 1384    def pastetext(self, window_name, object_name, position=0):385        """386        paste text from start position to end position387        388        @param window_name: Window name to type in, either full name,389        LDTP's name convention, or a Unix glob.390        @type window_name: string391        @param object_name: Object name to type in, either full name,392        LDTP's name convention, or a Unix glob. 393        @type object_name: string394        @param position: Position to paste the text, default 0395        @type object_name: integer396        @return: 1 on success.397        @rtype: integer398        """399        object_handle = self._get_object_handle(window_name, object_name)400        if not object_handle.AXEnabled:401            raise LdtpServerException(u"Object %s state disabled" % object_name)402        size = object_handle.AXNumberOfCharacters403        if position > size:404            position = size405        if position < 0:406            position = 0407        clipboard = Clipboard.paste()408        data = object_handle.AXValue409        object_handle.AXValue = data[:position] + clipboard + data[position:]...combo_box.py
Source:combo_box.py  
1# Copyright (c) 2017 VMware, Inc; AO Kaspersky Lab. All Rights Reserved.2# This file is part of ATOMac.3# @author: Nagappan Alagappan <nagappan@gmail.com>4# @copyright: Copyright (c) 2009-12 Nagappan Alagappan5# http://ldtp.freedesktop.org6# ATOMac is free software; you can redistribute it and/or modify7# it under the terms of the GNU General Public License as published by the Free8# Software Foundation version 2 and no later version.9# ATOMac is distributed in the hope that it will be useful, but10# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 212# for more details.13# You should have received a copy of the GNU General Public License along with14# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin15# St, Fifth Floor, Boston, MA 02110-1301 USA.16"""Combobox class."""17import re18from atomac import AXKeyCodeConstants19from .utils import Utils20from .server_exception import LdtpServerException21class ComboBox(Utils):22    def selectitem(self, window_name, object_name, item_name):23        """24        Select combo box / layered pane item25        26        @param window_name: Window name to type in, either full name,27        LDTP's name convention, or a Unix glob.28        @type window_name: string29        @param object_name: Object name to type in, either full name,30        LDTP's name convention, or a Unix glob. 31        @type object_name: string32        @param item_name: Item name to select33        @type object_name: string34        @return: 1 on success.35        @rtype: integer36        """37        object_handle = self._get_object_handle(window_name, object_name)38        if not object_handle.AXEnabled:39            raise LdtpServerException(u"Object %s state disabled" % object_name)40        self._grabfocus(object_handle.AXWindow)41        try:42            object_handle.Press()43        except AttributeError:44            # AXPress doesn't work with Instruments45            # So did the following work around46            x, y, width, height = self._getobjectsize(object_handle)47            # Mouse left click on the object48            # Note: x + width/2, y + height / 2 doesn't work49            self.generatemouseevent(x + 5, y + 5, "b1c")50            self.wait(5)51            handle = self._get_sub_menu_handle(object_handle, item_name)52            x, y, width, height = self._getobjectsize(handle)53            # on OSX 10.7 default "b1c" doesn't work54            # so using "b1d", verified with Fusion test, this works55            self.generatemouseevent(x + 5, y + 5, "b1d")56            return 157        # Required for menuitem to appear in accessibility list58        self.wait(1)59        menu_list = re.split(";", item_name)60        try:61            menu_handle = self._internal_menu_handler(object_handle, menu_list,62                                                      True)63            # Required for menuitem to appear in accessibility list64            self.wait(1)65            if not menu_handle.AXEnabled:66                raise LdtpServerException(u"Object %s state disabled" % \67                                          menu_list[-1])68            menu_handle.Press()69        except LdtpServerException:70            object_handle.activate()71            object_handle.sendKey(AXKeyCodeConstants.ESCAPE)72            raise73        return 174    # Since selectitem and comboselect implementation are same,75    # for Linux/Windows API compatibility let us assign selectitem to comboselect76    comboselect = selectitem77    def selectindex(self, window_name, object_name, item_index):78        """79        Select combo box item / layered pane based on index80        81        @param window_name: Window name to type in, either full name,82        LDTP's name convention, or a Unix glob.83        @type window_name: string84        @param object_name: Object name to type in, either full name,85        LDTP's name convention, or a Unix glob. 86        @type object_name: string87        @param item_index: Item index to select88        @type object_name: integer89        @return: 1 on success.90        @rtype: integer91        """92        object_handle = self._get_object_handle(window_name, object_name)93        if not object_handle.AXEnabled:94            raise LdtpServerException(u"Object %s state disabled" % object_name)95        self._grabfocus(object_handle.AXWindow)96        try:97            object_handle.Press()98        except AttributeError:99            # AXPress doesn't work with Instruments100            # So did the following work around101            x, y, width, height = self._getobjectsize(object_handle)102            # Mouse left click on the object103            # Note: x + width/2, y + height / 2 doesn't work104            self.generatemouseevent(x + 5, y + 5, "b1c")105        # Required for menuitem to appear in accessibility list106        self.wait(2)107        if not object_handle.AXChildren:108            raise LdtpServerException(u"Unable to find menu")109        # Get AXMenu110        children = object_handle.AXChildren[0]111        if not children:112            raise LdtpServerException(u"Unable to find menu")113        children = children.AXChildren114        tmp_children = []115        for child in children:116            role, label = self._ldtpize_accessible(child)117            # Don't add empty label118            # Menu separator have empty label's119            if label:120                tmp_children.append(child)121        children = tmp_children122        length = len(children)123        try:124            if item_index < 0 or item_index > length:125                raise LdtpServerException(u"Invalid item index %d" % item_index)126            menu_handle = children[item_index]127            if not menu_handle.AXEnabled:128                raise LdtpServerException(u"Object %s state disabled" % menu_list[-1])129            self._grabfocus(menu_handle)130            x, y, width, height = self._getobjectsize(menu_handle)131            # on OSX 10.7 default "b1c" doesn't work132            # so using "b1d", verified with Fusion test, this works133            window = object_handle.AXWindow134            # For some reason,135            # self.generatemouseevent(x + 5, y + 5, "b1d")136            # doesn't work with Fusion settings137            # Advanced window, so work around with this138            # ldtp.selectindex('*Advanced', 'Automatic', 1)139            """140            Traceback (most recent call last):141               File "build/bdist.macosx-10.8-intel/egg/atomac/ldtpd/utils.py", line 178, in _dispatch142                  return getattr(self, method)(*args)143               File "build/bdist.macosx-10.8-intel/egg/atomac/ldtpd/combo_box.py", line 146, in selectindex144                  self.generatemouseevent(x + 5, y + 5, "b1d")145               File "build/bdist.macosx-10.8-intel/egg/atomac/ldtpd/mouse.py", line 97, in generatemouseevent146                  window=self._get_front_most_window()147               File "build/bdist.macosx-10.8-intel/egg/atomac/ldtpd/utils.py", line 185, in _get_front_most_window148                  front_app=atomac.NativeUIElement.getFrontmostApp()149               File "build/bdist.macosx-10.8-intel/egg/atomac/AXClasses.py", line 114, in getFrontmostApp150                  raise ValueError('No GUI application found.')151            ValueError: No GUI application found.152            """153            window.doubleClickMouse((x + 5, y + 5))154            # If menuitem already pressed, set child to None155            # So, it doesn't click back in combobox in finally block156            child = None157        finally:158            if child:159                child.Cancel()160        return 1161    # Since selectindex and comboselectindex implementation are same,162    # for backward compatibility let us assign selectindex to comboselectindex163    comboselectindex = selectindex164    def getallitem(self, window_name, object_name):165        """166        Get all combo box item167        @param window_name: Window name to type in, either full name,168        LDTP's name convention, or a Unix glob.169        @type window_name: string170        @param object_name: Object name to type in, either full name,171        LDTP's name convention, or a Unix glob. 172        @type object_name: string173        @return: list of string on success.174        @rtype: list175        """176        object_handle = self._get_object_handle(window_name, object_name)177        if not object_handle.AXEnabled:178            raise LdtpServerException(u"Object %s state disabled" % object_name)179        object_handle.Press()180        # Required for menuitem to appear in accessibility list181        self.wait(1)182        child = None183        try:184            if not object_handle.AXChildren:185                raise LdtpServerException(u"Unable to find menu")186            # Get AXMenu187            children = object_handle.AXChildren[0]188            if not children:189                raise LdtpServerException(u"Unable to find menu")190            children = children.AXChildren191            items = []192            for child in children:193                label = self._get_title(child)194                # Don't add empty label195                # Menu separator have empty label's196                if label:197                    items.append(label)198        finally:199            if child:200                # Set it back, by clicking combo box201                child.Cancel()202        return items203    def showlist(self, window_name, object_name):204        """205        Show combo box list / menu206        207        @param window_name: Window name to type in, either full name,208        LDTP's name convention, or a Unix glob.209        @type window_name: string210        @param object_name: Object name to type in, either full name,211        LDTP's name convention, or a Unix glob. 212        @type object_name: string213        @return: 1 on success.214        @rtype: integer215        """216        object_handle = self._get_object_handle(window_name, object_name)217        if not object_handle.AXEnabled:218            raise LdtpServerException(u"Object %s state disabled" % object_name)219        object_handle.Press()220        return 1221    def hidelist(self, window_name, object_name):222        """223        Hide combo box list / menu224        225        @param window_name: Window name to type in, either full name,226        LDTP's name convention, or a Unix glob.227        @type window_name: string228        @param object_name: Object name to type in, either full name,229        LDTP's name convention, or a Unix glob. 230        @type object_name: string231        @return: 1 on success.232        @rtype: integer233        """234        object_handle = self._get_object_handle(window_name, object_name)235        object_handle.activate()236        object_handle.sendKey(AXKeyCodeConstants.ESCAPE)237        return 1238    def verifydropdown(self, window_name, object_name):239        """240        Verify drop down list / menu poped up241        242        @param window_name: Window name to type in, either full name,243        LDTP's name convention, or a Unix glob.244        @type window_name: string245        @param object_name: Object name to type in, either full name,246        LDTP's name convention, or a Unix glob. 247        @type object_name: string248        @return: 1 on success 0 on failure.249        @rtype: integer250        """251        try:252            object_handle = self._get_object_handle(window_name, object_name)253            if not object_handle.AXEnabled or not object_handle.AXChildren:254                return 0255            # Get AXMenu256            children = object_handle.AXChildren[0]257            if children:258                return 1259        except LdtpServerException:260            pass261        return 0262    def verifyshowlist(self, window_name, object_name):263        """264        Verify drop down list / menu poped up265        266        @param window_name: Window name to type in, either full name,267        LDTP's name convention, or a Unix glob.268        @type window_name: string269        @param object_name: Object name to type in, either full name,270        LDTP's name convention, or a Unix glob. 271        @type object_name: string272        @return: 1 on success 0 on failure.273        @rtype: integer274        """275        return self.verifydropdown(window_name, object_name)276    def verifyhidelist(self, window_name, object_name):277        """278        Verify list / menu is hidden in combo box279        280        @param window_name: Window name to type in, either full name,281        LDTP's name convention, or a Unix glob.282        @type window_name: string283        @param object_name: Object name to type in, either full name,284        LDTP's name convention, or a Unix glob. 285        @type object_name: string286        @return: 1 on success 0 on failure.287        @rtype: integer288        """289        try:290            object_handle = self._get_object_handle(window_name, object_name)291            if not object_handle.AXEnabled:292                return 0293            if not object_handle.AXChildren:294                return 1295            # Get AXMenu296            children = object_handle.AXChildren[0]297            if not children:298                return 1299            return 1300        except LdtpServerException:301            pass302        return 0303    def verifyselect(self, window_name, object_name, item_name):304        """305        Verify the item selected in combo box306        307        @param window_name: Window name to type in, either full name,308        LDTP's name convention, or a Unix glob.309        @type window_name: string310        @param object_name: Object name to type in, either full name,311        LDTP's name convention, or a Unix glob. 312        @type object_name: string313        @param item_name: Item name to select314        @type object_name: string315        @return: 1 on success.316        @rtype: integer317        """318        try:319            object_handle = self._get_object_handle(window_name, object_name)320            if not object_handle.AXEnabled:321                return 0322            role, label = self._ldtpize_accessible(object_handle)323            title = self._get_title(object_handle)324            if re.match(item_name, title, re.M | re.U | re.L) or \325                    re.match(item_name, label, re.M | re.U | re.L) or \326                    re.match(item_name, u"%u%u" % (role, label),327                             re.M | re.U | re.L):328                return 1329        except LdtpServerException:330            pass331        return 0332    def getcombovalue(self, window_name, object_name):333        """334        Get current selected combobox value335        336        @param window_name: Window name to type in, either full name,337        LDTP's name convention, or a Unix glob.338        @type window_name: string339        @param object_name: Object name to type in, either full name,340        LDTP's name convention, or a Unix glob. 341        @type object_name: string342        @return: selected item on success, else LdtpExecutionError on failure.343        @rtype: string344        """345        object_handle = self._get_object_handle(window_name, object_name)346        if not object_handle.AXEnabled:347            raise LdtpServerException(u"Object %s state disabled" % object_name)...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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
