-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·31 lines (24 loc) · 946 Bytes
/
test.py
File metadata and controls
executable file
·31 lines (24 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from selenium import webdriver
import time
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
# Function to search Google Scholar
def google_scholar_search(query):
search_box = driver.find_element_by_name('q')
search_box.clear()
search_box.send_keys(query)
search_box.submit()
time.sleep(2)
# Initialize WebDriver
driver_path = "/usr/bin/chromedriver" # Update this with your Chromedriver path
driver = webdriver.Chrome(executable_path=driver_path)
driver.get("https://scholar.google.com/")
# Open file and perform searches
with open('/home/shazam/Desktop/lines.txt', 'r') as f:
for line in f:
line = line.strip() # Remove any trailing whitespace
if line: # Only search if the line is not empty
print(f"Searching for: {line}")
google_scholar_search(line)
input("Press Enter to continue to the next search...")
# Close the browser
driver.quit()