I'm using Selenium Web Driver for automation and with this new app, I'm not able to find element by normal method. My code looks like:
driver.findElement(By.xpath("html/body/div[1]/md-sidenav/md-list[1]/md-list-item[2]/button")).click();
And I want to click on 'Views'. Need some help, I have tried following methods for xpath:
//span[contains(@class, 'ng-binding ng-scope') and normalize-space()='Data']
//div[1]/md-sidenav/descendant::span[text()='Data']/button ---- no success
When I'm using :
driver.findElement(By.xpath("html/body/div[1]/md-sidenav/md-list[1]/md-list-item[2]/button")).click();
Above code works but I don't want to use item[x], because they will changes very often.
Please help! Thanks!