I am having trouble testing a dropdown on a webpage I built with React and the Ant Design framework. I am attempting to use SeleniumBase or Selenium Webdriver for the task.
The dropdown in question can be viewed here: https://ant.design/components/select/
It is called "Select with the search field" and has three options: Jack, Lucy, and Tom.
Despite identifying the XPath as
'//*[@id="rc_select_13"]'
, I am unable to successfully click and select an option.
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 code above throws a
selenium.common.exceptions.ElementNotVisibleException
error.
In my manual testing, clicking on the dropdown first before selecting an option seems to work. I suspect I need to implement a click event before using self.select_option_by_text()
.