Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0ed27c

Browse files
committed
add browser testing with selenium & edge browser tutorial
1 parent433cc05 commitc0ed27c

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ This is a repository of all the tutorials of [The Python Code](https://www.thepy
9595
-[How to Extract YouTube Comments in Python](https://www.thepythoncode.com/article/extract-youtube-comments-in-python). ([code](web-scraping/youtube-comments-extractor))
9696
-[How to Extract All PDF Links in Python](https://www.thepythoncode.com/article/extract-pdf-links-with-python). ([code](web-scraping/pdf-url-extractor))
9797
-[How to Extract Images from PDF in Python](https://www.thepythoncode.com/article/extract-pdf-images-in-python). ([code](web-scraping/pdf-image-extractor))
98+
-[Automated Browser Testing with Edge and Selenium in Python](https://www.thepythoncode.com/article/automated-browser-testing-with-edge-and-selenium-in-python). ([code](web-scraping/selenium-edge-browser))
9899

99100
-###[Python Standard Library](https://www.thepythoncode.com/topic/python-standard-library)
100101
-[How to Transfer Files in the Network using Sockets in Python](https://www.thepythoncode.com/article/send-receive-files-using-sockets-python). ([code](general/transfer-files/))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#[Automated Browser Testing with Edge and Selenium in Python](https://www.thepythoncode.com/article/automated-browser-testing-with-edge-and-selenium-in-python)
2+
To run this:
3+
-`pip3 install -r requirements.txt`
4+
- Run`main1.py` or`main2.py`
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# importing required package of webdriver
2+
fromseleniumimportwebdriver
3+
# Just Run this to execute the below script
4+
if__name__=='__main__':
5+
# Instantiate the webdriver with the executable location of MS Edge web driver
6+
browser=webdriver.Edge(r"C:\Users\LenovoE14\Downloads\edgedriver\msedgedriver.exe")
7+
# Simply just open a new Edge browser and go to lambdatest.com
8+
browser.get('https://www.lambdatest.com')
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# importing required package of webdriver
2+
3+
fromseleniumimportwebdriver
4+
fromselenium.webdriver.chrome.optionsimportOptions
5+
fromtimeimportsleep
6+
fromselenium.webdriver.supportimportexpected_conditionsasEC
7+
fromselenium.webdriver.common.byimportBy
8+
fromselenium.common.exceptionsimportTimeoutException
9+
fromselenium.webdriver.support.uiimportWebDriverWait
10+
fromselenium.webdriver.opera.optionsimportOptions
11+
# Just Run this main.py to execute the below script
12+
fromselenium.webdriver.support.waitimportWebDriverWait
13+
14+
if__name__=='__main__':
15+
# Instantiate the webdriver with the executable location of MS Edge
16+
browser=webdriver.Edge(r"C:\Users\LenovoE14\Downloads\edgedriver\msedgedriver.exe")
17+
# Simply just open a new Edge browser and go to lambdatest.com
18+
browser.maximize_window()
19+
browser.get('https://www.lambdatest.com')
20+
21+
try:
22+
# Get the text box to insert Email using selector ID
23+
myElem_1=WebDriverWait(browser,10).until(EC.presence_of_element_located((By.ID,'useremail')))
24+
# Entering the email address
25+
myElem_1.send_keys("rishabhps@lambdatest.com")
26+
myElem_1.click()
27+
# Get the Submit button to click and start free testing using selector CSS_SELECTOR
28+
myElem_2=WebDriverWait(browser,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"#testing_form > div")))
29+
# Starting free testing on LambdaTest
30+
myElem_2.click()
31+
sleep(10)
32+
exceptTimeoutException:
33+
print("No element found")
34+
35+
sleep(10)
36+
37+
browser.close()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
selenium==3.141
2+
msedge-selenium-tools

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp