diff --git a/mdgo/forcefield/pubchem.py b/mdgo/forcefield/pubchem.py index 03c5e8eb..e488aa53 100644 --- a/mdgo/forcefield/pubchem.py +++ b/mdgo/forcefield/pubchem.py @@ -145,8 +145,8 @@ def _obtain_entry_web(self, search_text: str, name: str, output_format: str) -> query = quote(search_text) url = "https://pubchem.ncbi.nlm.nih.gov/#query=" + query self.web.get(url) - time.sleep(1) loaded_element_path = '//*[@id="main-results"]/div[1]/div/ul' + self.wait.until(EC.presence_of_element_located((By.XPATH, loaded_element_path))) best_xpath = '//*[@id="featured-results"]/div/div[2]' "/div/div[1]/div[2]/div[1]/a/span/span" relevant_xpath = ( '//*[@id="collection-results-container"]' @@ -157,7 +157,9 @@ def _obtain_entry_web(self, search_text: str, name: str, output_format: str) -> match = self.web.find_element(By.XPATH, best_xpath) else: match = self.web.find_element(By.XPATH, relevant_xpath) + self.wait.until(EC.element_to_be_clickable(match)) match.click() + time.sleep(1) # density_locator = '//*[@id="Density"]/div[2]/div[1]/p' cid_locator = '//*[@id="Title-and-Summary"]/div/div/div/div[1]/div[2]' smiles_locator = '//*[@id="Canonical-SMILES"]/div[2]/div[1]'