Best Python code snippet using pyatom_python
value.py
Source:value.py
...38 return 139 except:40 pass41 return 042 def verifyscrollbarhorizontal(self, window_name, object_name):43 """44 Verify scrollbar is horizontal45 46 @param window_name: Window name to type in, either full name,47 LDTP's name convention, or a Unix glob.48 @type window_name: string49 @param object_name: Object name to type in, either full name,50 LDTP's name convention, or a Unix glob.51 @type object_name: string52 53 @return: 1 on success.54 @rtype: integer55 """56 try:57 object_handle = self._get_object_handle(window_name, object_name)58 if object_handle.AXOrientation == "AXHorizontalOrientation":59 return 160 except:61 pass62 return 063 def setmax(self, window_name, object_name):64 """65 Set max value66 67 @param window_name: Window name to type in, either full name,68 LDTP's name convention, or a Unix glob.69 @type window_name: string70 @param object_name: Object name to type in, either full name,71 LDTP's name convention, or a Unix glob.72 @type object_name: string73 74 @return: 1 on success.75 @rtype: integer76 """77 object_handle = self._get_object_handle(window_name, object_name)78 object_handle.AXValue = 179 return 180 81 def setmin(self, window_name, object_name):82 """83 Set min value84 85 @param window_name: Window name to type in, either full name,86 LDTP's name convention, or a Unix glob.87 @type window_name: string88 @param object_name: Object name to type in, either full name,89 LDTP's name convention, or a Unix glob.90 @type object_name: string91 92 @return: 1 on success.93 @rtype: integer94 """95 object_handle = self._get_object_handle(window_name, object_name)96 object_handle.AXValue = 097 return 198 99 def scrollup(self, window_name, object_name):100 """101 Scroll up102 103 @param window_name: Window name to type in, either full name,104 LDTP's name convention, or a Unix glob.105 @type window_name: string106 @param object_name: Object name to type in, either full name,107 LDTP's name convention, or a Unix glob.108 @type object_name: string109 110 @return: 1 on success.111 @rtype: integer112 """113 if not self.verifyscrollbarvertical(window_name, object_name):114 raise LdtpServerException('Object not vertical scrollbar')115 return self.setmin(window_name, object_name)116 117 def scrolldown(self, window_name, object_name):118 """119 Scroll down120 121 @param window_name: Window name to type in, either full name,122 LDTP's name convention, or a Unix glob.123 @type window_name: string124 @param object_name: Object name to type in, either full name,125 LDTP's name convention, or a Unix glob.126 @type object_name: string127 128 @return: 1 on success.129 @rtype: integer130 """131 if not self.verifyscrollbarvertical(window_name, object_name):132 raise LdtpServerException('Object not vertical scrollbar')133 return self.setmax(window_name, object_name)134 def scrollleft(self, window_name, object_name):135 """136 Scroll left137 138 @param window_name: Window name to type in, either full name,139 LDTP's name convention, or a Unix glob.140 @type window_name: string141 @param object_name: Object name to type in, either full name,142 LDTP's name convention, or a Unix glob.143 @type object_name: string144 145 @return: 1 on success.146 @rtype: integer147 """148 if not self.verifyscrollbarhorizontal(window_name, object_name):149 raise LdtpServerException('Object not horizontal scrollbar')150 return self.setmin(window_name, object_name)151 152 def scrollright(self, window_name, object_name):153 """154 Scroll right155 156 @param window_name: Window name to type in, either full name,157 LDTP's name convention, or a Unix glob.158 @type window_name: string159 @param object_name: Object name to type in, either full name,160 LDTP's name convention, or a Unix glob.161 @type object_name: string162 163 @return: 1 on success.164 @rtype: integer165 """166 if not self.verifyscrollbarhorizontal(window_name, object_name):167 raise LdtpServerException('Object not horizontal scrollbar')168 return self.setmax(window_name, object_name)169 def onedown(self, window_name, object_name, iterations):170 """171 Press scrollbar down with number of iterations172 173 @param window_name: Window name to type in, either full name,174 LDTP's name convention, or a Unix glob.175 @type window_name: string176 @param object_name: Object name to type in, either full name,177 LDTP's name convention, or a Unix glob.178 @type object_name: string179 @param interations: iterations to perform on slider increase180 @type iterations: integer181 182 @return: 1 on success.183 @rtype: integer184 """185 if not self.verifyscrollbarvertical(window_name, object_name):186 raise LdtpServerException('Object not vertical scrollbar')187 object_handle = self._get_object_handle(window_name, object_name)188 i = 0189 maxValue = 1.0 / 8190 flag = False191 while i < iterations:192 if object_handle.AXValue >= 1:193 raise LdtpServerException('Maximum limit reached')194 object_handle.AXValue += maxValue195 time.sleep(1.0 / 100)196 flag = True197 i += 1198 if flag:199 return 1200 else:201 raise LdtpServerException('Unable to increase scrollbar')202 203 def oneup(self, window_name, object_name, iterations):204 """205 Press scrollbar up with number of iterations206 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 @param interations: iterations to perform on slider increase214 @type iterations: integer215 216 @return: 1 on success.217 @rtype: integer218 """219 if not self.verifyscrollbarvertical(window_name, object_name):220 raise LdtpServerException('Object not vertical scrollbar')221 object_handle = self._get_object_handle(window_name, object_name)222 i = 0223 minValue = 1.0 / 8224 flag = False225 while i < iterations:226 if object_handle.AXValue <= 0:227 raise LdtpServerException('Minimum limit reached')228 object_handle.AXValue -= minValue229 time.sleep(1.0 / 100)230 flag = True231 i += 1232 if flag:233 return 1234 else:235 raise LdtpServerException('Unable to decrease scrollbar')236 237 def oneright(self, window_name, object_name, iterations):238 """239 Press scrollbar right with number of iterations240 241 @param window_name: Window name to type in, either full name,242 LDTP's name convention, or a Unix glob.243 @type window_name: string244 @param object_name: Object name to type in, either full name,245 LDTP's name convention, or a Unix glob.246 @type object_name: string247 @param interations: iterations to perform on slider increase248 @type iterations: integer249 250 @return: 1 on success.251 @rtype: integer252 """253 if not self.verifyscrollbarhorizontal(window_name, object_name):254 raise LdtpServerException('Object not horizontal scrollbar')255 object_handle = self._get_object_handle(window_name, object_name)256 i = 0257 maxValue = 1.0 / 8258 flag = False259 while i < iterations:260 if object_handle.AXValue >= 1:261 raise LdtpServerException('Maximum limit reached')262 object_handle.AXValue += maxValue263 time.sleep(1.0 / 100)264 flag = True265 i += 1266 if flag:267 return 1268 else:269 raise LdtpServerException('Unable to increase scrollbar')270 def oneleft(self, window_name, object_name, iterations):271 """272 Press scrollbar left with number of iterations273 274 @param window_name: Window name to type in, either full name,275 LDTP's name convention, or a Unix glob.276 @type window_name: string277 @param object_name: Object name to type in, either full name,278 LDTP's name convention, or a Unix glob.279 @type object_name: string280 @param interations: iterations to perform on slider increase281 @type iterations: integer282 283 @return: 1 on success.284 @rtype: integer285 """286 if not self.verifyscrollbarhorizontal(window_name, object_name):287 raise LdtpServerException('Object not horizontal scrollbar')288 object_handle = self._get_object_handle(window_name, object_name)289 i = 0290 minValue = 1.0 / 8291 flag = False292 while i < iterations:293 if object_handle.AXValue <= 0:294 raise LdtpServerException('Minimum limit reached')295 object_handle.AXValue -= minValue296 time.sleep(1.0 / 100)297 flag = True298 i += 1299 if flag:300 return 1...
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!!