rkfddf написать xpath локатор который преобразует регистр :
[
'//a[contains(@href,"{}")]'.format(url_fragment.lower()),
'//a[contains(translate(@href, "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), "{}")]'.format(url_fragment.upper())
]
length = len(xpaths)
for cnt in range(length):
xpath = xpaths[cnt]
print('# try {}'.format(cnt))
element = None
try:
element = driver.find_element_by_xpath(xpath)
except InvalidSelectorException, e:
print('Exception (ignored): {}'.format(e))
pass
except NoSuchElementException, e:
print('Exception (ignored): {0}'.format(e))
pass
if element != None:
print('Found via {}'.format(xpath))
print(element.get_attribute('outerHTML'))
else:
print('Failed via {}'.format(xpath))