我该如何解决这个问题 "is not a valid XPath expression"

How can I solve this "is not a valid XPath expression"

我正在尝试 select 来自国家/地区下拉菜单的国家/地区。

List<WebElement> countryDropDown = driver.findElements(By.xpath(("(//div[@class='uk-dropdown uk-open uk-dropdown-bottom-center']//li")));
WebdriverHelper.selectOptionFromDropDown(countryDropDown, "Spain");

下拉菜单打开,显示列表,然后我收到此消息:

Failed to execute 'evaluate' on 'Document': The string '(//div[@class='uk-dropdown uk-open uk-dropdown-bottom-center']//li' is not a valid XPath expression

这里有多余的括号。
而不是

List<WebElement> countryDropDown = driver.findElements(By.xpath(("(//div[@class='uk-dropdown uk-open uk-dropdown-bottom-center']//li")));

试试这个:

List<WebElement> countryDropDown = driver.findElements(By.xpath("//div[@class='uk-dropdown uk-open uk-dropdown-bottom-center']//li"));