Linked Questions

Popular Questions

program not giving [Finished in xs] when it's done

Asked by At

i am getting the correct results but in sublime editor it always gives [Finished in xs] when it's done

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import os
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
#chrome_options.add_argument('--start-maximized')
driver=webdriver.Chrome(chrome_options=chrome_options)
driver.get('https://www.google.com')
print (driver.title)
x=driver.find_element_by_xpath('//*[@id="tsf"]/div[2]/div/div[1]/div/div[1]/input')
x.clear()
x.send_keys("Hello world from python")
x.send_keys(Keys.RETURN)
li=[]
links=driver.find_elements_by_xpath("//a[@href]")
li=[link.get_attribute("href") for link in links if "google" not in link.get_attribute("href")]
for i in range(2,7):
    driver.get(li[i])
    print (driver.title)
driver.close()
print ("DONE")

This is the output:

Google
Hello, World! - Learn Python - Free Interactive Python Tutorial
Python Program to Print Hello world!
Say "Hello, World!" With Python | HackerRank
Hello World: Create your First Python Program
Hello World in Python || Python Tutorial || Python Programming - YouTube
DONE

I want to know what seems to be the problem with this code only that it is not giving [Finish in ..] in the end

Related Questions