0

So pyperclip is a module used to copy data that can later be pasted or used for other purposes. I have been working on creating a program that automates the process of using a plagiarism checking website and I soon plan on making my plagarism checking software as well. I used both selenium and pyperclip to help me accomplish my task. This is my code:

import sys
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as Ec
import pyperclip
print("This is a basic plagarism checker that removed of the hassle that comes with doing everything yourself")
i = 0
while i == 0:
    open_file = input("What do you want to check, copy and paste it here:")
    if len(open_file) >= 30: #ensures that text is sufficient enough to be checked
        i += 1
    else:
        print("It is hard to check plagarism for a small amount of words, please enter some more!")
        i = 0
driver = webdriver.Chrome("C:/Users/Shitty Horrible Pc/PycharmProjects/learningpython/pytjom/chromedriver.exe") #access the webdriver
pyperclip.copy(open_file) #copys your input
driver.implicitly_wait(10) #tells program to wait for specific objects on the website to load in
driver.get("http://plagiarisma.net/") #goes to the plagarism checker website
element = driver.find_element_by_id("query") #find text box
element.send_keys(open_file) #pastes in text box
element = driver.find_element_by_name("Submit") #finds checker button
element.click() #presses it and gives an authenticity report)
driver.implicitly_wait(10)
html = driver.find_element_by_tag_name('html')
if len(open_file) >= 200:
    time.sleep(22)
else:
    time.sleep(8)
for letter in "AAAAAAAAAAAAAAAAAA":
    html.send_keys(Keys.ARROW_DOWN)

As you can see, I used pyperclip to copy an input given by the user and used selenium to paste it into a text-book. Everything works fine, but when I try to copy a very lengthy input, only the first line of the input is pasted (the input is broken into segments in my pycharm console). I have manually verified that the website I am using does not share that same restriction. This leads me to assume that pyperclip might have a character limit. Does anyone know if my assumptions are correct? If not, any ideas of what else it could be?

  • "Everything works fine, but when I try to copy a very lengthy input, only the first line of the input is pasted" - well, you only *read* the first line of the input. `input` reads one line. – user2357112 Nov 14 '20 at 01:12
  • You're not even using what you copied with `pyperclip`. You just send keystrokes corresponding to what you read with `input`. You could remove `pyperclip` entirely and this program would behave the same. – user2357112 Nov 14 '20 at 01:15
  • Alright, I see. Do you know how I can loop my input so that it reads and pastes it all? – Fayeze Salih Nov 14 '20 at 01:56

0 Answers0