Skip to content

Commit 2404e3f

Browse files
authored
Update index.py
1 parent 5b52251 commit 2404e3f

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

src/index.py

+38-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,46 @@
11
from fastapi import FastAPI
22

33
from src.dtos.ISayHelloDto import ISayHelloDto
4-
4+
from selenium import webdriver
5+
import time
6+
from selenium.webdriver.common.by import By
7+
from selenium.webdriver.chrome.options import Options
8+
import os
9+
import json
10+
from selenium import webdriver
11+
from selenium.webdriver.support.ui import WebDriverWait
12+
from selenium.webdriver.chrome.options import Options as ChromeOptions
13+
from selenium.webdriver.support import expected_conditions as EC
14+
from selenium.webdriver.common.by import By
15+
from selenium.common.exceptions import NoSuchElementException
16+
import time
517
app = FastAPI()
618

19+
BROWSERSTACK_USERNAME = "tranngocminh_AFiWRo"
20+
BROWSERSTACK_ACCESS_KEY = "8anY1yMSZhs7qsHCzLeD"
21+
URL = "https://hub.browserstack.com/wd/hub"
22+
723

824
@app.get("/")
925
async def root():
10-
return {"message": "Hello World"}
11-
12-
13-
@app.get("/hello/{name}")
14-
async def say_hello(name: str):
15-
return {"message": f"Hello {name}"}
16-
17-
18-
@app.post("/hello")
19-
async def hello_message(dto: ISayHelloDto):
20-
return {"message": f"Hello {dto.message}"}
26+
BROWSERSTACK_USERNAME = BROWSERSTACK_USERNAME
27+
BROWSERSTACK_ACCESS_KEY = BROWSERSTACK_ACCESS_KEY
28+
URL = URL
29+
30+
bstack_options = {
31+
"os": "OS X",
32+
"osVersion": "Monterey",
33+
"buildName": "browserstack-build-1",
34+
"sessionName": "BStack single python",
35+
"userName": BROWSERSTACK_USERNAME,
36+
"accessKey": BROWSERSTACK_ACCESS_KEY
37+
}
38+
bstack_options["source"] = "python:sample-main:v1.0"
39+
options = ChromeOptions()
40+
options.set_capability('bstack:options', bstack_options)
41+
driver = webdriver.Remote(
42+
command_executor=URL,
43+
options=options)
44+
driver.get("https://www.synthesia.io/features/avatars")
45+
driver.quit()
46+
return {"message": "tôi tên là ngọc"}

0 commit comments

Comments
 (0)