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/")
        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,508 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,770 points
6,519 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
5,505 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,341 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
16,283 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,880 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
13,767 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
9,186 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
7,260 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