Skip to content

Instantly share code, notes, and snippets.

@tk-o
Last active December 7, 2016 20:52
Show Gist options
  • Save tk-o/cf895e8a3be3d4a0968ef2d72c47e111 to your computer and use it in GitHub Desktop.
Save tk-o/cf895e8a3be3d4a0968ef2d72c47e111 to your computer and use it in GitHub Desktop.
C# Selenium vs. JavaScript
C# Selnium JavaScript (in Chrome Dev Tools)
driver document
driver.FindElement(By.Id("someId")) document.getElementById("someId")
driver.FindElements(By.ClassName("someClassName")) document.getElementsByClassName("someClassName")
driver.FindElement(By.CssSlector("#some-id .some-css-class tag")) document.querySelector("#some-id .some-css-class tag")
driver.FindElements(By.CssSlector("#some-id .some-css-class tag")) document.querySelectorAll("#some-id .some-css-class tag")
driver.FindElements(By.XPath("//*[@id='categories-menu']/li")) $x("//*[@id='categories-menu']/li")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment