Open
Description
Great work man!.
First I want to share some modification that I did. ` async def handle_prompt(self, prompt_text):
# Get the dialog element
dialog = await self.page.querySelector('div[role="dialog"]')
if dialog:
# Get all the link elements
links = await dialog.querySelectorAll('a')
for link in links:
# Get the link text
link_text = await self.page.evaluate('(element) => element.textContent', link)
if link_text == 'Stay logged out':
print('Found a link with text "Stay logged out"')
await link.click()
await asyncio.sleep(0.5)
prompt_textarea = await self.page.querySelector('#prompt-textarea')
if prompt_textarea is None:
print("Cannot find the prompt input on the webpage.\nPlease check whether you have access to chat.openai.com without logging in via your browser.")
self.session_active = False
await self.close()
return
try:
# await self.page.type('#prompt-textarea', prompt_text, {'delay': 3})
# await self.page.type('#prompt-textarea', prompt_text, {'delay': 1})
await self.page.type('#prompt-textarea', random.choice(string.ascii_letters))
await self.page.evaluate(f"() => {{document.querySelector('#prompt-textarea').value = '{prompt_text}';}}")
await asyncio.sleep(5)` I'm testing with visible browser so '''Stay logged out''' popup might not come when you work windowless mode. Second thing is typing letter by letter for larger prompt last forever so I type one char to make submit btn enabled and then paste the text. I saw you change the browser test lib from pypeteer to playwright, but unfortunately both stop to work. I think they done extra protection or some kind of ban. Although normal browser window works just fine.
** I tried with Tor browser same thing. They have some kind of protection. Cloud.... get into verification loop even I"m checking I'm human.
Metadata
Assignees
Labels
No labels