1

Hi i'm trying to interact with this web element in the following link https://www.gurufocus.com/stocks

Here you can find the image

I want to set it to 100 so that i can visualize 100 stocks at the time i've tried to interact with it by using the following code

wd.find_element_by_xpath("/html/body/div[1]/div/div/div[1]/section[2]/main/div/div[1]/div[3]/div[1]/span/div[2]").click()

wd.find_element_by_xpath("/html/body/div[2]/div[6]").click()

But only the first line works the second line gives me the following error

    selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id='el-popover-2775']"}
  (Session info: chrome=106.0.5249.119)

It is not able to locate it i have also tried with the method find element_by_id but still not able to locate the button that sets the number on 100 This one does anyone has an other solution? Thanks in advance let me know if you need more information i will answer as soon as possible.

0

1 Answer 1

1

you can select the dropdown like this:

from selenium.webdriver.common.by import By
driver.find_element(By.CLASS_NAME, "aio-tabs-button").click()

and select 100 like this:

driver.find_element(By.XPATH, "//div[@class='item' and contains(text(), '100')]").click()

However, I'd recommend using the API and a package like requests instead of simulating the browser.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi thank you for your answer can you put an example of how to put all the 82k tickers in a list? I have tried with pandas but it returned error 403 thanks in advance
i mean with the request module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.