Skip to content

Latest commit

 

History

History
108 lines (71 loc) · 6.18 KB

README.md

File metadata and controls

108 lines (71 loc) · 6.18 KB

Quora QA Automation

Welcome to the Quora QA Automation project, an open-source program that utilizes Selenium and GPT-3 for answering questions on Quora.

Overview

This open-source program uses a combination of Selenium and GPT-3 to answer questions on the Quora platform. The program utilizes Selenium to automate the opening of a Chrome browser, navigates to the Quora website, extracts the first question listed on the page, and passes it to GPT-3 for a response. The response generated by GPT-3 is then posted on Quora.

The program employs the OpenAI API for accessing GPT-3, which provides the necessary interface for making requests to the GPT-3 model. This integration allows the program to leverage GPT-3's state-of-the-art natural language processing capabilities, which are capable of generating human-like responses to a wide variety of questions.

One key advantage of this program is its flexibility in allowing users to specify a custom data directory for the Chrome browser. This feature provides users with the option to store their browsing data, such as cookies and cache, in a location of their choosing.

This program is ideal for anyone looking to automate their Quora activities, particularly those who frequently respond to questions on the platform. By leveraging GPT-3's advanced natural language processing capabilities, the program can generate high-quality responses to questions, saving users significant time and effort.

Customization

This program can be customized to your personal/organizational needs. For more information, please contact me via LinkedIn or email at [email protected]

Frameworks:

Selenium - a popular automation testing framework that provides a suite of tools for web browser automation. It allows for programmatically controlling a web browser and automating user actions, such as clicking buttons, filling forms, and extracting data from web pages.

OpenAI API - a powerful artificial intelligence API that provides access to GPT-3, a language model capable of generating human-like text. It can be used for a variety of natural language processing tasks, such as language translation, summarization, and conversation generation.

Language:

Flow diagrams:

Requirements:

Modules:

API:

Classes:

Functions:

  1. answer_quora_question(answer): This function is used to post an answer received from GPT-3 on Quora and selecting a personalized answer credential.
  2. extract_question(): This function is used to extract the first question listed on www.quora.com/answers and return it as a string.
  3. gpt3_completion(prompt, engine='text-davinci-002', temp=0.7, top_p=1.0, tokens=400, freq_pen=0.0, pres_pen=0.0, stop=['JAX:', 'USER:']): This function is used to ask GPT-3 the question extracted from Quora and return the respone text as a string.
  4. launch_test_case(): This function is used to open Quora in a Chrome instance.
  5. open_file(filepath): This function is used to open a file and read the contents.
  6. quit_application(): This function is used to close the Chrome browser.
  7. setup(): This function is used to maximize Chrome window and have the driver wait for 10 seconds.
  8. main(): This function is the main method in JavaScript.
  9. loop(): This function is used to call the main method in a loop.

Procedure:

  1. Install the required libraries: openai, selenium-webdriver, and chrome.
  2. Copy your API key from the OpenAI website.
  3. Define Chrome options.
  4. Instansiate Google Chrome with the above options.
  5. Create a method to post answer received from GPT-3 on Quora and selecting a personalized answer credential.
  6. Create a method to extract the first question listed on www.quora.com/answers and return it as a string.
  7. Create a method to ask GPT-3 the question extracted from Quora and return the respone text as a string.
  8. Create a method to open Quora in a Chrome instance.
  9. Create a method to open a file and read the contents.
  10. Create a method to close the Chrome browser.
  11. Create a setup method to maximize the Chrome window and have the driver wait for 10 seconds.
  12. Create a main method to call the above methods.
  13. Call the main method in a loop.

Resources:

  1. OpenAI
  1. YouTube
  1. Playwright Documentation

Additional notes:

Potential errors:

If you encounter the error message "timeout: Timed out receiving message from renderer" while attempting to paste an answer into a text box, it is possible that the page load timeout has been set too low. In such instances, it is advisable to increase the page load timeout using the set_page_load_timeout() method.

For example, if you are using the Selenium library in Python, you can increase the page load timeout by executing the following code:

from selenium import webdriver

driver = webdriver.Chrome()
driver.set_page_load_timeout(X) # Increase the timeout to X seconds

In the code above, the set_page_load_timeout() method is responsible for specifying the maximum time the browser should wait for a page to load before throwing an error. By increasing this timeout value, you may be able to circumvent the "timeout: Timed out receiving message from renderer" error.

It is important to remember to adjust the timeout value based on your specific needs and internet speed. A lengthier timeout may result in slower test execution, so finding the appropriate balance is crucial.