-2
我試圖通過我的值來獲取隨機選擇複選框與動態ID和代碼粘貼下面與相應的錯誤消息。出現如何在Selenium Webdriver中爲XPath使用單引號?
By.xpath("//div[contains(@id,'team_"+randNumber(i)+")]")) != null){
錯誤爲:
The given selector //div[contains(@id,'team_'2)] is either invalid or does not result in a WebElement.
因此,上述術語應具有爲//div[contains(@id,'team_2')]