How to use _find_element method in AutoItDriverServer

Best Python code snippet using AutoItDriverServer_python

__init__.py

Source:__init__.py Github

copy

Full Screen

...74 Note: this method utilizes chromes automatic downloading for files. 75 If the url points to a page chrome wants to load, it will load it.76 """77 self.goto(url)78 def _find_element(self,LOCATOR):79 """80 Exposes driver for the purpose of locating elements on site.81 """82 return self.driver.find_element(*LOCATOR)83 def upload_files(self,source_directory,file_list,destination_directory=""):84 print('\tUploading files...')85 no_files = len(file_list)86 no_cycles = int(math.floor(no_files/5.0))87 remainder = no_files%588 for i in range(no_cycles):89 print("test!")90 self._find_element(Locators.UPLOAD_BUTTON_LOCATOR).click()91 for j in range(5):92 file_field = self._find_element(Locators.FILE_ID_LOCATORS[j])93 file_field.send_keys(source_directory+"/"+file_list[5*i+j])94 self._find_element(Locators.UPLOAD_SUBMIT_LOCATOR).click()95 self._close_window_when_done()96 97 if(remainder):98 self._find_element(Locators.UPLOAD_BUTTON_LOCATOR).click()99 for j in range(remainder):100 file_field = self._find_element(Locators.FILE_ID_LOCATORS[j])101 file_field.send_keys(source_directory+"/"+file_list[5*no_cycles+j])102 self._find_element(Locators.UPLOAD_SUBMIT_LOCATOR).click()103 self._close_window_when_done()104 105 def create_folder(self,folder_name):106 self._find_element(Locators.CREATE_FOLDER_LOCATOR).click()107 self._find_element(Locators.FOLDER_NAME_LOCATOR).send_keys(folder_name)108 self._find_element(Locators.FOLDER_SUBMIT_BUTTON_LOCATOR).click()109 110 pass111 def _close_window_when_done(self):112 # TODO: Implement this method.113 pass114 def close(self):115 self.driver.close()116 def __exit__(self,exc_type,exc_value,traceback):...

Full Screen

Full Screen

page.py

Source:page.py Github

copy

Full Screen

...37 self.driver = context.driver38 db_host = getattr(context, 'dblogger_host', None)39 context.logger = dblogger.DBLogger(dbhost = db_host)40 self.context = context41 def _find_element(self, name, parameter=None):42 """43 This method allows to find element,44 based on descriptions in Object Library,45 xpath, id, name or pertial link text.46 If parameter != None will be used name % parameter47 """48 lib_name = "objects/objects.xml"49 if self.name:50 lib_name = "objects/%s.xml" % self.name51 lib = objects_library.ObjectsLibrary(lib_name)52 if lib.get_object(name):53 name = lib.get_object(name)54 if parameter:55 name = name % parameter56 obj = None57 k = 058 while (obj is None and k < self.timeout):59 k += 160 try:61 obj = self.driver.find_element_by_name(name)62 return obj63 except:64 pass65 try:66 obj = self.driver.find_element_by_id(name)67 return obj68 except:69 pass70 try:71 obj = self.driver.find_element_by_xpath(name)72 return obj73 except:74 pass75 try:76 obj = self.driver.find_element_by_partial_link_text(name)77 return obj78 except:79 pass80 self.context.logger.error(error_msg % name)81 return None82 def Open(self, url):83 self.driver.get(url)84 def Refresh(self):85 self.driver.refresh()86 def TableCell(self, name, parameter=None):87 obj = self._find_element(name, parameter)88 table = elements.TableCellClass(obj)89 return table90 def Button(self, name, parameter=None):91 obj = self._find_element(name, parameter)92 button = elements.ButtonClass(obj)93 return button94 def Link(self, name, parameter=None):95 obj = self._find_element(name, parameter)96 link = elements.LinkClass(obj)97 return link98 def EditBox(self, name, parameter=None):99 obj = self._find_element(name, parameter)100 edit = elements.EditBoxClass(obj)101 return edit102 def DropDownList(self, name, parameter=None):103 obj = self._find_element(name, parameter)104 select = elements.DropDownListClass(obj)105 return select106 def Navigate(self, path):107 """108 This method allows to navigate by109 webUI menu button and links to110 the specific page111 """112 steps = path.split('>')113 for step in steps:114 self.Button(step).Click()...

Full Screen

Full Screen

base_page.py

Source:base_page.py Github

copy

Full Screen

...15 use_locator = self.locator_type(locator)16 element = WebDriverWait(self.driver, time_out_sec).until(17 EC.presence_of_element_located((use_locator, locator)))18 return element19 def _find_element(self, locator, time_out_sec=10):20 return self.wait_for_element_present(locator, time_out_sec)21 def click(self, locator):22 element = self._find_element(locator)23 element.click()24 def get_text(self, locator):25 element = self._find_element(locator)26 return element.text27 def enter_text(self, locator, text):28 element = self._find_element(locator)29 element.send_keys(text)30 def delete_element(self, locator):31 element = self._find_element(locator)32 element.clear()33 def scroll_down(self):...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run AutoItDriverServer automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful