I created this code in order to obtain the number related to the data-instrument-id in this html page "https://app.plus500.com/trade/amazon", before finding the data-instrument-id i specified the upper class (I'm not an expert in html). Once I run the code I get back this error :
"selenium.common.exceptions.JavascriptException: Message: javascript error: b.toLowerCase is not a function"
I read on internet that this error comes out because I didn't convert the number I get from the data-instrument-id, but I still can't convert it because I should do it inside the .get_attribute function.
focus on the def get_options if you need to see the website use this username: myrandomcode@gmail.com and this password: MyRandomCode86
don't worry is a dummy account
def get_options():
opzioni = []
opzioni_ottenute = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "//div["
"starts-with("
"@class, "
"'section-table-body"
"')]//span[text( "
")='Amazon"
"']//following "
"::div[ "
"2]")))
id_og = opzioni_ottenute.get_attribute((By.CSS_SELECTOR, "data-instrument-id"))
print(id_og)
indice = 0
while indice < 21:
if (id_og[indice] % 2) != 0:
opzioni.append(id_og)
indice = indice + 1
print(opzioni)