Reputation: 337
I've been struggling with finding the xpath to:
div class='text-title tile-text-desc'>"Text here" /div
driver.findElement(By.xpath("//vue-kit.strand[@qa-id='MAIN_MENU_FEATURED']/div[@class='container']/div[@class='ember-view scroller']/ui-kit.collection-view.item-view[@class='ember-view item-view tile is-first is-program focus']"));
I have also tried:
driver.findElement(By.xpath("//vue-kit.strand[@qa-id='MAIN_MENU_FEATURED']/div[@class='container']/div[@class='ember-view scroller']/ui-kit.collection-view.item-view[@class='ember-view item-view tile is-first is-program focus']/div[@class='meta']/div[@class='text-title tile-text-desc']"));
I can access @class='ember-view item-view tile is-first is-program focus'
which returns an array. Then I can access the elements in the array with webElement and findElements. From here I'm not sure how to get the exact element that I want.
Please help me to solve this.
Upvotes: 0
Views: 848
Reputation: 46
Use relative path and xpath functions to get the dynamic id
Since @Class has "text-title tile-text-desc" so you can try as below:
//div[contains(@class,'text-title tile-text-desc')]
Upvotes: 1