-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
feature or fix already existsUpgrade to the latest version as neededUpgrade to the latest version as needed
Description
I am trying to click on a drop down box created in React in order to select an item in it
This is my SeleniumBase code which is not working (running with pytest --browser=firefox
)
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('//*[@id="rc_select_13"]')
Error message is
exception = <class 'selenium.common.exceptions.ElementNotVisibleException'>
message = '\n Element {//*[@id="rc_select_13"]} was not visible after 6 seconds!'
Trying the same with Selenium Webdriver (this works)
# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
class TestAdddevice:
def setup_method(self, method):
# self.driver = webdriver.Firefox()
self.driver = webdriver.Firefox(
executable_path=r"/usr/local/lib/python3.7/dist-packages/seleniumbase-1.42.4-py3.7.egg/seleniumbase/drivers/geckodriver"
)
self.vars = {}
def teardown_method(self, method):
self.driver.quit()
def test_adddevice(self):
self.driver.get("https://ant.design/components/select/")
self.driver.find_element(By.XPATH, "//*[@id='rc_select_13']").click()
This works.
The XPATH is exactly the same, but for some reason SeleniumBase cannot click it.
As I workaround I use this code which works
from seleniumbase import BaseCase
from selenium.webdriver.common.by import By
class MyTestClass(BaseCase):
def test_ant_dropdown(self):
url = "https://ant.design/components/select/"
self.open(url)
self.assert_title("Select - Ant Design")
self.driver.find_element(By.XPATH, "//*[@id='rc_select_13']").click()
Metadata
Metadata
Assignees
Labels
feature or fix already existsUpgrade to the latest version as neededUpgrade to the latest version as needed