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
1,910 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(tex ...READ MORE

answered Nov 26, 2020 in Selenium by Gitika
• 65,870 points
478 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,040 points
2,823 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 27, 2018 in Selenium by nsv999
• 5,520 points
8,029 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
11,936 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
6,087 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,520 points
5,058 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,010 points
5,801 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,890 points
3,568 views