0

I would like to extract input value(s) from Google maps inputbox using xpath. For eg: for these inputs

So I should get "Toronto Pearson International Airport"

When I do (//input)[2]/text(). I donot get any value. I have also tried (//input[@class="tactile-searchbox-input"])[4] which shows destination("Toronto Pearson International Airport") in "value" property when I check in chrome console.

What would be the right approach here to extract value from input box.

katch
  • 820
  • 1
  • 7
  • 24
  • If I have to do only within selenium, I guess question will be duplicate. I am looking for pure XPath solution to extract value. – katch Oct 03 '18 at 09:37
  • There is no pure XPath solution. Selenium support XPath that returns WebElement only – Andersson Oct 03 '18 at 09:39
  • So xpath cannot extract properties like "value" that we see in chrome element? – katch Oct 03 '18 at 09:46
  • XPath can extract attribute value, but not in Selenium: `driver.find_element_by_xpath('//input').get_attribute('value')` (OK), `driver.find_element_by_xpath('//input/@value')` (not OK) – Andersson Oct 03 '18 at 09:53
  • so in chrome `$x("(//input)[1]/@value")` does not return any value – katch Oct 03 '18 at 10:21

0 Answers0