mfoud444 commited on
Commit
535be32
1 Parent(s): 3bbe00e
Files changed (1) hide show
  1. s.py +19 -17
s.py CHANGED
@@ -1,26 +1,28 @@
 
 
 
1
 
2
- import undetected_chromedriver as uc
 
3
 
4
- options = uc.ChromeOptions()
 
5
 
6
- user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36'
 
7
 
8
- options = uc.ChromeOptions()
9
- options.add_argument('--headless')
10
- options.add_argument('window-size=1400,1500')
11
- options.add_argument('--disable-gpu')
12
- options.add_argument('--no-sandbox')
13
- options.add_argument('start-maximized')
14
- options.add_argument('enable-automation')
15
- options.add_argument('--disable-infobars')
16
- options.add_argument('--disable-dev-shm-usage')
17
- options.add_argument('--remote-debugging-port=9222')
18
- options.add_argument('--user-data-dir=/home/ubuntu/chrome_profiles')
19
 
20
- driver = uc.Chrome(options=options)
 
 
 
 
 
 
 
21
 
22
- driver.get('https://nowsecure.nl')
23
- driver.save_screenshot('screen.png')
24
 
25
  # import time
26
  # from g4f.Provider.bing import CreateImagesBing
 
1
+ # s.py
2
+ from selenium import webdriver
3
+ from selenium.webdriver.common.keys import Keys
4
 
5
+ # Create a new instance of the Chrome driver
6
+ driver = webdriver.Chrome()
7
 
8
+ # Navigate to Google
9
+ driver.get("https://www.google.com")
10
 
11
+ # Find the search box using its name attribute value
12
+ search_box = driver.find_element("name", "q")
13
 
14
+ # Type a search query
15
+ search_box.send_keys("Hello, Docker!")
 
 
 
 
 
 
 
 
 
16
 
17
+ # Submit the search form
18
+ search_box.send_keys(Keys.RETURN)
19
+
20
+ # Wait for a few seconds to observe the result
21
+ input("Press Enter to exit...")
22
+
23
+ # Close the browser window
24
+ driver.quit()
25
 
 
 
26
 
27
  # import time
28
  # from g4f.Provider.bing import CreateImagesBing