3
我有一個函數,它帶有By元素,By by = By.xpath(「xpathString」)。在我的方法,我用下面的語句來找到另一個WebElement使用Selenium和XPath,將By元素轉換爲字符串
findElement(by).findElements(By.xpath(anotherXPathString))
有誰知道的方式來操作首先讓我可以將它們合併,所以我可以用一個findElement功能?我查看了Selenium By class頁面,並且無法將By轉換爲字符串或組合爲不同的By元素。我的目標是有它看起來像
By newby = (however we will combine the two by statements);
findElements(newby);
或
String newXPath = (however we convert the by to a string) + anotherXPathString;
findElements(By.xpath(newXPath));
聖牛,這很酷:)。 –
哇,這真是太棒了。它解決了我的問題! – Bob