Python Forum
Can't access the net using Python's Selenium module
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't access the net using Python's Selenium module
#1
Hey there!
I am creating a program that concerns with accessing the net. But my script isn't able to do it. I have used selenium module. Please look into the code I have attached and let me know if it has any problem. I am connected to the internet and the rest of my script works perfectly as it should.
def search_web(input): 

    driver = webdriver.Chrome()
    driver.implicitly_wait(1) 
    driver.maximize_window() 

    if 'youtube' in input.lower(): 

        assistant_speaks("Opening in youtube") 
        indx = input.lower().split().index('youtube') 
        query = input.split()[indx + 1:] 
        driver.get("http://www.youtube.com/results?search_query =" + '+'.join(query)) 
        return

    elif 'wikipedia' in input.lower(): 

        assistant_speaks("Opening Wikipedia") 
        indx = input.lower().split().index('wikipedia') 
        query = input.split()[indx + 1:] 
        driver.get("https://en.wikipedia.org/wiki/" + '_'.join(query)) 
        return

    else: 

        if 'google' in input: 

            indx = input.lower().split().index('google') 
            query = input.split()[indx + 1:] 
            driver.get("https://www.google.com/search?q =" + '+'.join(query)) 

        elif 'search' in input: 

            indx = input.lower().split().index('google') 
            query = input.split()[indx + 1:] 
            driver.get("https://www.google.com/search?q =" + '+'.join(query)) 

        else: 

            driver.get("https://www.google.com/search?q =" + '+'.join(input.split())) 

        return
Reply


Messages In This Thread
Can't access the net using Python's Selenium module - by ShishirModi - Jul-20-2020, 04:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to access variables from dirsync module steve_shambles 3 3,899 Apr-02-2020, 08:18 AM
Last Post: steve_shambles
  Python for MS Access DB Kundan 0 1,893 Feb-20-2020, 08:27 AM
Last Post: Kundan
  Access list items in Python kamaleon 2 2,386 Dec-31-2019, 11:10 AM
Last Post: kamaleon
  Access webcam via python ArnabRoyBatman 1 4,323 Jun-15-2017, 05:19 AM
Last Post: j.crater
  Access online database from python d4py 5 9,469 Dec-23-2016, 11:28 PM
Last Post: d4py

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020