Issue
I'm testing some automation on a website and I encountered a <p>
tag inside an iframe
. I need to populate some text specifically between the <p></p>
tags.
I've already tried using .text() = 'some text'
but it does not work
I've also tried doing .text('some text')
with no success
I was just recently initiated into python and selenium so this is really hard to figure out for some reason
Python Code
from selenium import webdriver
browser.get('www.somewebsite.com')
iframe = browser.find_element_by_id('IFR1')
browser.switch_to.frame(iframe)
browser.find_element_by_tag_name("p").text() = 'this is a txt test'
print('success')
I expect the <p>
tag to have 'this is a txt text' but nothing happens
Solution
After a lot of trial and error I was able to use ActionChains(browser).send_keys('this is a test').perform()
in order to achieve writing some text inside the tags
Answered By - quality InterAct
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.