I am trying to write a program that scraps for the IUPACcondensed on this webpage .
Here G03307GF
is the ID. I need this:
HexNAc(b1-?)[Fuc(a1-?)]GlcNAc(b1-2)Man(a1-3)[HexNAc(b1-?)[Fuc(a1-?)]GlcNAc(b1-2)Man(a1-6)]Man(b1-4)GlcNAc(b1-4)[Fuc(a1-6)]GlcNAc
I tried to use selenium for this.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
driver = webdriver.Chrome('', options = chrome_options)
# takes accession number and returns IUPAC
def getIUPAC(acc_no):
url = 'https://glytoucan.org/Structures/Glycans/' + acc_no
driver.get(url)
IUPAC = driver.find_element_by_xpath('//*[@id="descriptors"]/togostanza-iupaccondensed//main/div/pre/code/text()')
driver.close()
return IUPAC
IUPAC = getIUPAC('G37498VS')
print(IUPAC)
It says the the element does not exist.