I have a webpage written in React using the Ant Design framework. I am trying to test a dropdown with SeleniumBase (but also open to solutions with Selenium Webdriver)
The function can be found here: https://ant.design/components/select/
Called: Select with the search field
When you click the field there is a drop-down showing three options:
Jack
Lucy
Tom
I have identified the XPath to it as '//*[@id="rc_select_13"]'
I am trying to click and select one of the options, but even clicking on it seems impossible
from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_ant_dropdown(self):
url = "https://ant.design/components/select/"
self.open(url)
self.assert_title("Select - Ant Design")
self.click_xpath('//*[@id="rc_select_13"]')
The above code fails with selenium.common.exceptions.ElementNotVisibleException
If I during the test manually help by clicking on the dropdown, the test exists with success.
I figured I need to click on it first to get a proper drop-down to select an option in afterward with the function self.select_option_by_text()