def test_chromote(): from chromote import Chromote chrome = Chromote() tab0 = chrome.tabs[0] sites = [ 'https://github.com', 'http://stackoverflow.com', ] tab0.set_url(sites[0]) print(tab0) tab1 = chrome.add_tab(sites[1]) print(tab1) chrome.close_tab(tab1) tab2 = chrome.add_tab() print(tab2)
print r r = tab_popup.evaluate('document.getElementsByClassName("profile_action_btn")[1].getElementsByTagName("button")[0].click()') print r except AttributeError: print 'Profile.toggleFriend:' r = tab_popup.evaluate('document.getElementsByClassName("profile_action_btn")[1].getElementsByTagName("button")[0].click()') print r try: print 'acceptFriendBtn!' r = tab_popup.evaluate('document.querySelectorAll("a.acceptFriendBtn")[0].click()') print r except AttributeError: print 'AttributeError=>Public.subscribe:' #r = tab_popup.evaluate('Public.subscribe()') r = tab_popup.evaluate('document.querySelector("#page_actions button#public_subscribe").click()') print r else: print 'else: Group.subscribe:' r = tab_popup.evaluate('document.querySelectorAll("button#join_button")[0].click()') print r time.sleep(.990) # Wait for 990 milliseconds time.sleep(mt_rand(6,7)) chrome.close_tab(tab_popup) time.sleep(mt_rand(6,9))
ErrMes = "Maximum Attempts Reached. Your Browser Has Either Not Started Or Has Remote Debugging Disabled" print(ErrMes) os.system('espeak "' + ErrMes + '"') TabSTT = krom.tabs[0] TabSTT.set_url("http://localhost:" + str(ServPort) + "/STTTS.html") WelcTh.join() while True: sleep(1) PagSour = TabSTT.html if (PagSour[PagSour.find("<title>") + 7:PagSour.find("</title>")] == "Recording"): break os.system("aplay " + pwd + "/Beep.wav") while True: sleep(1) PagSour = TabSTT.html if (PagSour[PagSour.find("<title>") + 7:PagSour.find("</title>")] == "Done"): break PagSour = TabSTT.html STT = PagSour[PagSour.find('<span id="confm">') + 17:PagSour.find("</span>")] krom.close_tab(TabSTT) print(STT) os.system('espeak "' + STT + '"') os.system("sudo fuser -k " + str(ServPort) + "/tcp") ServTh.join()