-1

I was trying to select an option using Selenium in python.

Below is my code:from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.support import expected_conditions as EC

from selenium.webdriver.common.keys import Keys

import pandas as pd

from bs4 import BeautifulSoup

import requests as r

import time

from selenium.webdriver.support.ui import Select

PATH="chromedriver.exe"

driver=webdriver.Chrome(PATH)

url1="https://cannacabana.com/collections/all?page=1"

driver.get(url1)

Select(WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "select#store-select")))).select_by_visible_text('bayview')


I am getting timeout error, could it be because the website has Optgroup? I am not able to find a way through it. enter image description here

0

1 Answer 1

2

No, it uses ".//" so Optgroup doesn't matter. You can see the implementation here.

I believe value="bayview" is not visible_text so you should use select_by_value() instead.

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

1 Comment

It gives me TimeoutException error when I use select_by_value() instead

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.