-
Notifications
You must be signed in to change notification settings - Fork 0
/
executeScript.py
33 lines (22 loc) · 970 Bytes
/
executeScript.py
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
32
33
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.alert import Alert
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC, wait
import time
driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_submit_get")
driver.implicitly_wait(4)
driver.switch_to.frame('iframeResult')
# driver.find_element(By.XPATH,"/html/body/button").click()
driver.execute_script("myFunction()")
elem = driver.find_element(By.ID,"mySubmit")
driver.execute_script("arguments[0].style.border='3px solid red'", elem)
time.sleep(5)
driver.switch_to.default_content()
frames = driver.find_elements(By.TAG_NAME,"iframe")
time.sleep(5)
driver.find_element(By.ID,"test")