Error results because I am unable to obtain the correct element through xpath. Has the web handle changed? Can I click an image? I don't understand how to interpret the error.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
driver = webdriver.Chrome()
#browser.get('https://ebs.lcb.state.pa.us/OA_HTML/AppsLocalLogin.jsp')
driver.get('http://www.finewineandgoodspirits.com')
assert 'Fine Wine & Good Spirits: Shop Online for Wine and Spirits in Pennsylvania' in driver.title
browser.find_element_by_xpath("xpath=//div[@id='ageVerify']/img[@alt='Yes']").click()
InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression xpath=//div[@id='ageVerify']/img[@alt='Yes'] because of the following error: TypeError: Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted to the desired type. (Session info: chrome=59.0.3071.115) (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 6.1.7601 SP1 x86_64)
WebElementlocator. Open your browser console and start using jQuery to validate if your selector is valid (e.g.:$x(//div[@id='ageVerify']/img[@alt='Yes']), or$(div#ageVerify img[alt="Yes"])for CSS-path). Your error cannot be more verbose than that. (Unable to locate an element with the xpath exp..., which translates to, your selector's not good) - iamdanchiv