Python PhantomJS Sending Keys to Text Field Not Working -
so i'm having weird problem phantomjs continually failing send text text input field. when run code chrome driver, there no issue, , works expected.
this chat box on twitch streams if wondering. here code.
print("finding chat box...") typekeyword = wait_until_visible_by_xpath('//textarea[@placeholder="send message"]', browser) not_working = true while not_working: try: print("sending keys...") typekeyword.send_keys("hi") not_working = false except invalidelementstateexception: sleep(3) print("hitting chat button") chatbutton = wait_until_visible_by_xpath('//button[@class="button send-chat-button primary float-right"]', browser) chatbutton.click() phantomjs able locate text field, keeps getting trapped on invalidelementstateexception when checking whether can send keys or not. there should small delay because twitch chat box grayed out 6-10 seconds before becomes able type in it. chrome driver, after printing "sending keys..." 3 times, code finishes , message typed. phantomjs, however, prints "sending keys..." forever.
refind/"refresh" element inside loop:
while not_working: typekeyword = browser.find_element_by_xpath('//textarea[@placeholder="send message"]') ...
Comments
Post a Comment