python selenium find element search class and text and Repetition

0 votes
def ref(self):
    while True:
        driver = self.driver
        driver.get("https://www.instagram.com/p/CAGHDBAnVaq/")
        time.sleep(2)
        element = driver.find_element_by_xpath("//div[@class='FH9sR']/span[text()='Reply']")
        element.click()
        time.sleep(2)
        comment_box = driver.find_element_by_xpath('/html/body/div[1]/section/main/div/div[1]/article/div[2]/section[3]/div/form/textarea')
        comment_box.send_keys('@bebinfact   هرگز باورت نمیشه اینجا  چی هست')
        comment_box.send_keys(Keys.RETURN)
        nextBut = driver.find_element_by_xpath("//button[contains(.,'Post')]")
        time.sleep(5)
        nextBut.click()
        time.sleep(2)
        elemen = driver.find_element_by_xpath("//div[@class='FH9sR']/span[text()='Reply']")
        elemen.click()
        time.sleep(2)
        comment_bo = driver.find_element_by_xpath('/html/body/div[1]/section/main/div/div[1]/article/div[2]/section[3]/div/form/textarea')
        comment_bo.send_keys('@bebinfact   هرگز باورت نمیشه اینجا  چی هست')
        comment_bo.send_keys(Keys.RETURN)
        nextBu = driver.find_element_by_xpath("//button[contains(.,'Post')]")
        time.sleep(5)
        nextBu.click()
        time.sleep(2)

Jun 14, 2020 in Selenium by anonymous
• 120 points
3,218 views
Hey, Could you please elaborate on your query? What problem are you facing exactly? Also, post the error log if any!

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Selenium

+1 vote
1 answer
0 votes
1 answer

How do I find an element that contains specific text in Selenium WebDriver (Python)?

Try the following: driver.find_elements_by_xpath("//*[contains(text(), 'My Button')]") I hope this ...READ MORE

answered Nov 27, 2020 in Selenium by Gitika
• 65,910 points
5,776 views
0 votes
2 answers

Python & Selenium: How to find and click on YouTube's Like button

Hello Nitin, as the Like button on ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,140 points
4,939 views
0 votes
1 answer

Python + Selenium - Trying to find element by link containing certain words

2 issues. One thing is, "Catalogues" & ...READ MORE

answered Mar 28, 2018 in Selenium by nsv999
• 5,500 points
9,127 views
0 votes
1 answer
0 votes
3 answers

How to click the search button using Selenium web driver and Python

You can try with tag. #this code will ...READ MORE

answered Apr 10, 2019 in Selenium by Matin
15,681 views
0 votes
1 answer

Installing Selenium Webdriver with Python package

Hey Hemant, for installing Selenium Webdriver with ...READ MORE

answered May 8, 2019 in Selenium by Anvi
• 14,150 points
15,199 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
12,731 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,616 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
6,692 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP