1
我有一個塊,「類別」。 該塊有一個隱形的配置鏈接(配置鏈接:<a class="contextual-links-trigger" href="#">Configure</a>
) 當我手動移動鼠標到這個塊時,配置鏈接變爲<a class="contextual-links-trigger contextual-links-trigger-active" href="#">Configure</a>
並且配置圖標顯示(基於新類「contextual-links-trigger-active」)。 當我點擊配置圖標,鏈接「編輯視圖」將顯示。 (見圖片)如果使用java webdriver不會顯示隱形鏈接
我想點擊鏈接 「編輯觀點」 使用的Java Web驅動程序。 我用下面的代碼顯示的配置圖標,但沒有成功:
Actions builder = new Actions(driver);
builder.moveToElement(driver.findElement(By.xpath(xpath))).perform();
請給我一些想法。謝謝!
感謝您的想法。我用它來處理我的情況。它運作良好。這裏是我的代碼: JavascriptExecutor js =(JavascriptExecutor)driver; (「document.querySelector('#」+ block_id +「.contextual-links-trigger')。classList.add('contextual-links-trigger-active');」); (包含(@id,''+ block_id +'')] // a [contains(@class,' 。語境鏈接觸發活性')]「)))點擊(); –
很高興它幫助..在stackoverflow其自定義接受答案或upvote,如果它的作品,以便它會幫助其他人誰在今後提到這.. – Amith