2017-04-06 93 views
0

我創建了一些單元測試,並使用Appium來運行這些測試。我希望能夠點擊一個按鈕,通常我可以使用FindElementByName屬性,但在這種情況下,我不能這樣做,因爲有2個元素具有相同的名稱。單擊按鈕Appium C#

下面是我使用檢查員時可以看到的屬性圖像。

enter image description here

PowerPointSession.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10)); 
     PowerPointSession.FindElement(By.XPath("//a[contains(text(), 'Open') or contains(text(), 'open')]")).Click(); 

我也試過

PowerPointSession.FindElementByName("Open").Click(); 

回答

0

最後我身邊做了工作,只是這樣做

PowerPointSession.Keyboard.SendKeys(Keys.Enter); 

做的伎倆