Jump to content

Selenium and Python


Recommended Posts

Can't find a way to create a new note using Selenium for Python in a headless enviroment. 

These are my entire tries (none of these methods worked in a headless enviroment). Is there a solution? Thank you.


    try:
        wd.find_element_by_xpath('//*[@id="qa-CREATE_NOTE"]').click()
        sleep(1)
        wd.find_element_by_xpath('//*[@id="ActionMenu"]/ul[1]/li[1]/button').click()
        print("criou nova nota")
    except:
        try:
            wd.find_element_by_xpath('//*[@id="qa-CREATE_NOTE"]/path').click()
            sleep(1)
            wd.find_element_by_xpath('//*[@id="ActionMenu"]/ul[1]/li[1]/button/svg/path[1]').click()
        except:
            try:
                wd.find_element_by_xpath('//*[@id="qa-NOTELIST_SUBHEADER_ACTIONS"]').click()
            except:
                try:
                    wd.find_element_by_id('qa-NOTELIST_SUBHEADER_ACTIONS').click()
                    print("achei o menu pelo ID")
                    sleep(0.5)
                except:
                    try:
                        wd.find_element_by_class_name('_2hOozI1nBOe0Iwq14eLL-O').click()
                        sleep(0.5)
                        wd.find_element_by_class_name('oA-DV8tcbOZMAioJiHwK4').click()
                    except:
                        try:
                            wd.find_elements_by_class_name('Button')[1].click()
                            sleep(0.2)
                            wd.find_element_by_link_text('Nota').click()
                        except:
                            try:
                                wd.find_element_by_xpath('//*[@id="qa-ACTION_ADD_NEW_NOTE"]/div/span/span').click()
                            except:
                                wd.find_element_by_id('qa-ACTION_ADD_NEW_NOTE').click()

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...