Category : find

I am writing a script in python where I want to read the collection names from the Java file annotation Basically, I want to search "@Entity(value = "*****DO"" in each file and print the output. I tried subprocess.check_output([‘grep’, ‘-r’, ‘DO’]) but it is not helping, it is giving me all the DO occurrence but I ..

Read more

I have a page where both of the following elements or only the one will be visible. How can I check if any of these two elements exist? My code is for example: def element_one(): driver.find_element(By.CSS_SELECTOR, ".selector_one").is_displayed() def element_two(): driver.find_element(By.CSS_SELECTOR, ".selector_two").is_displayed() if element_one() or element_two(): print("OK") else: print("ERROR") Doesn’t work for me if also tried ..

Read more

I’v a little request for you, I need help on this code: def grepi(dico, fichier): line_number = 0 nameFile = os.path.basename(fichier) # Chargement dico with open(dico, encoding="utf-8") as dic: dicolist = dic.read().splitlines() # Recherche dans fichier with open(fichier, encoding="utf-8") as fic: ficlist = fic.read().splitlines() for line in ficlist: line_number += 1 for patt in dicolist: ..

Read more

I’m trying to handle a POST response where I get an XML. The result is saved as bytes b”: <?xml version="1.0" encoding="utf-8"?> <result xmlns="http://something.com/Schema/V2/Result"> <success>false</success> <returnType>ERROR</returnType> <errors> <error> <message>Invalid signature</message> <code>3002</code> </error> </errors> </result> Code: from lxml import etree as et root_node = et.fromstring(response.content) print(‘{}’.format(root_node.find(‘.//returnType’))) return_type = root_node.find(‘.//returnType’).text The print statement return None, so the ..

Read more