Skip to content

Commit

Permalink
page load fix
Browse files Browse the repository at this point in the history
  • Loading branch information
htz1992213 committed Nov 9, 2023
1 parent bcddad5 commit f172fa4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mdgo/forcefield/pubchem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]'
Expand All @@ -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]'
Expand Down

0 comments on commit f172fa4

Please sign in to comment.