file_input = driver.find_element_by_name('profilePic') file_input.send_keys("path/to/profilepic.gif") # Generally it's better to wrap the file path in one of the methods # in os.path to return the actual path to support cross OS testing. # file_input.send_keys(os.path.abspath("path/to/profilepic.gif"))
""" # transfer file to another machine only if remote driver is used # the same behaviour as for java binding if self.parent._is_remote: local_file = self.parent.file_detector.is_local_file(*value) if local_file isnotNone: value = self._upload(local_file)
defkeys_to_typing(value): """Processes the values that will be typed in the element.""" typing = [] for val in value: ifisinstance(val, Keys): typing.append(val) elifisinstance(val, int): val = str(val) for i inrange(len(val)): typing.append(val[i]) else: for i inrange(len(val)): typing.append(val[i]) return typing