xpath for text in selenium code example Example 1: xpath text //tag[text()='sometext'] Example 2: xpath contains text //button[contains(text(),"Go")]