try: scamframe = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "//iframe[@id='scmframe']"))) driver.switch_to.frame(scamframe) contentfra = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "content"))) driver.switch_to.frame(contentfra) commentframe = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "search-editor"))) driver.switch_to.frame(commentframe) wait.until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[1]/c-wiz/div/div/c-wiz/div/div/div[2]/div[2]/div[1]/div[2]/textarea'))).send_keys("New Search") element = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "/html[1]/body[1]/div[1]/c-wiz[1]/div[1]/div[1]/c-wiz[1]/div[1]/div[1]/div[2]/div[3]/div[1]/div[1]/span[1]/span[1]"))) driver.execute_script("arguments[0].innerText = 'kSalih001'", element) WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//span[contains(text(),"kSalih001")]'))).click() except NoSuchElementException: try: link = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH,"//a[@id='search-editor-src']"))) print(link.get_attribute('href')) driver.get(link.get_attribute('href')) except NoSuchElementException: pass print('Element Not Found!') driver.quit() os._exit(0)
try: print("item found") except NoSuchElementException: print("item not found") pass
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)