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.

5
  • 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 3, 2018 at 9:37
  • There is no pure XPath solution. Selenium support XPath that returns WebElement only
    – Andersson
    Oct 3, 2018 at 9:39
  • So xpath cannot extract properties like "value" that we see in chrome element?
    – katch
    Oct 3, 2018 at 9: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 3, 2018 at 9:53
  • so in chrome $x("(//input)[1]/@value") does not return any value
    – katch
    Oct 3, 2018 at 10:21

0

Browse other questions tagged or ask your own question.