Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium 1 drivecollab #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions README.md

This file was deleted.

40 changes: 40 additions & 0 deletions hack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
import time
import pyautogui
from selenium.webdriver.remote.file_detector import UselessFileDetector

x=400
y=254

email = (By.ID,"i0116")
next = (By.ID,"idSIButton9")
passw = (By.ID,"i0118")

driver = webdriver.Chrome("/usr/local/bin/chromedriver")
driver.maximize_window()

driver.get("https://login.microsoftonline.com/dec2e631-d656-473c-afff-447008969d2f/oauth2/authorize?client_id=00000003-0000-0ff1-ce00-000000000000&response_mode=form_post&protectedtoken=true&response_type=code%20id_token&resource=00000003-0000-0ff1-ce00-000000000000&scope=openid&nonce=06A7E8476B916E5B799822719B418D164BB2D44BD22D80C1-6069B6B8341E670EF89F50F100919AEE505D098F67BE8C81A6F28AE14DDB2F5D&redirect_uri=https%3A%2F%2Fiiitborg-my.sharepoint.com%2F_forms%2Fdefault.aspx&claims=%7B%22id_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22CP1%22%5D%7D%7D%7D&wsucxt=1&cobrandid=11bd8083-87e0-41b5-bb78-0bc43c8a8e8a&client-request-id=f623b69f-f0ae-0000-83c3-75b9b18bdad3")

WebDriverWait(driver,10).until(EC.element_to_be_clickable(email)).send_keys("") #FILL IN YOUR EMAIL ACCOUNT WITHIN THE QUOATATION MARKS

WebDriverWait(driver,10).until(EC.element_to_be_clickable(next)).click()

WebDriverWait(driver,10).until(EC.element_to_be_clickable(passw)).send_keys("") # FILL IN YOUR PASSWORD WITHIN THE QUOATION MARKS

WebDriverWait(driver,10).until(EC.element_to_be_clickable(next)).click()

WebDriverWait(driver,10).until(EC.element_to_be_clickable(next)).click()

da = driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/div/div/div/div[2]/div[1]/div/div/div/div/div/div[1]/div[2]/button')

action = ActionChains(driver)

action.move_to_element(da).click().perform()

time.sleep(2)
pyautogui.click(x,y)
30 changes: 30 additions & 0 deletions project-details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

## Video

Here's a video for you to watch the accomplishment of my code ------>(https://youtu.be/T9DVo9yyNSI) (the video is unlisted).

## Dependencies

selenium,pyautogui,time modules.

## Installation

How to install on Linux...

You are required to download the Chrome Driver from https://chromedriver.storage.googleapis.com/index.html?path=89.0.4389.23/ .
Install Selenium using the ```pip3 install selenium``` ( Check this out if you are stuck anywhere--->(https://youtu.be/67h3IT2lm40)).
Install pyautogui using ```python3 -m pip install pyautogui``` .

## Usage

This is an incomplete project which was used to upload any file to your onedrive business account. (Yes there are api's for it,but your administrator might not allow you to create an application for your business account.)

The code manages to open the Open File Dialog Box for you to select the required file to upload it on to your ondrive .(90% of the code is done)

Further modificitaions can be made to the code such that when provided with the login credentials and the file path, the code can manage to upload the specified file automatically.

At the very least,the code can be used as very simple password manager which autlogin's you to your accounts whith small modifications.

## Contribution SetUp

You can combine the code with javascript to overcome the Open File Dialog Box. Check this out --->(https://stackoverflow.com/questions/62211837/how-to-avoid-the-open-file-dialog-box-by-uploading-the-file-directly-with-python/62219380#62219380).