I am trying to switch to an iframe in selenium (Python). Though, no matter what I try, I keep getting an error.
iframes = driver.find_elements_by_tag_name('iframe')
print(len(iframes))
for iframe in iframes:
if 'ontouchmove' in iframe:
print(iframe)
driver.switch_to.frame(iframe)
This produces the error -
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: missing 'ELEMENT'
I have also tried this -
iframes = driver.find_elements_by_tag_name('iframe')
print(len(iframes))
counter = 0
for iframe in iframes:
if 'ontouchmove' in iframe:
print(iframe)
driver.switch_to.frame(counter)
counter += 1
this produces the error -
selenium.common.exceptions.JavascriptException: Message: javascript error: frame.setAttribute is not a function
I am not really sure what else I can do here, kind of lost.. any help would be appreciated.
Edit:
iframes = driver.find_elements_by_tag_name('iframe')
print(len(iframes))
driver.switch_to.frame(iframes[0])
This produces error:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: missing 'ELEMENT'