Skip to content

Commit b1f2b34

Browse files
new tab automation
1 parent 504eb6f commit b1f2b34

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed
File renamed without changes.

SeleniumNewTabs.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
# https://github.com/SergeyPirogov/webdriver_manager?tab=readme-ov-file#use-with-chrome
3+
4+
from selenium import webdriver
5+
from selenium.webdriver.common.by import By
6+
from webdriver_manager.chrome import ChromeDriverManager
7+
8+
import time, requests
9+
from bs4 import BeautifulSoup as bs
10+
11+
link = 'https://www.upgrad.com/learn/'
12+
web = webdriver.Chrome(ChromeDriverManager().install())
13+
14+
web.get(link)
15+
req = requests.get(link)
16+
17+
soup = bs(req.content, 'html5lib')
18+
Carousel_item__UUZAx = soup.findAll('div', attrs = {'class':'Carousel_item__UUZAx'})
19+
20+
counter = 1
21+
for i in Carousel_item__UUZAx:
22+
for j in i.findAll('a'):
23+
24+
link = j['href']
25+
req = requests.get(link)
26+
soup = bs(req.content, 'html5lib')
27+
28+
session = soup.findAll('div', attrs = {'class':'session'})
29+
for c, k in enumerate(session):
30+
link = k.a['href']
31+
print(link)
32+
33+
web.execute_script("window.open('');")
34+
web.switch_to.window(web.window_handles[counter])
35+
36+
web.get(link)
37+
counter += 1
38+
time.sleep(1)
39+
40+
input('Press Enter to Exit.')
41+
web.close()

static/20.12.2023_19.48.43_REC.mp4

48.3 MB
Binary file not shown.
File renamed without changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[InternetShortcut]
2+
URL=https://www.youtube.com/watch?v=2WK9vK1fbjY

0 commit comments

Comments
 (0)