Skip to content

Instantly share code, notes, and snippets.

@bablukpik
Last active July 19, 2019 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bablukpik/300cd6e37e51ed693026edd359f4891c to your computer and use it in GitHub Desktop.
Save bablukpik/300cd6e37e51ed693026edd359f4891c to your computer and use it in GitHub Desktop.
// To find closest id using jquery
var id = $("button").closest("div").prop("id");
// To find closest id using javascript
<li id='myLi' onclick="alert(this.parentNode.id)">A</li>
// Menu Text Related
await this.waitFor(`//a[contains(@class, 'selected') and contains(text(), '${tabName}')]`);
await this.waitFor(`//a[contains(@class, 'selected') and text()='${tabName}']`);
### Decendent Element find
//div[contains(text(), 'Cancellation')]/parent::div/parent::div/following-sibling::div
### Sibling find based on string
//div[contains(text(), 'Cancellation')]/following-sibling::div
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment