The navigator does not take the url that I indicate to him using Selenium on Python



  • everyone. First, excuse me for my bad English. I will try to go a specific URL but just the browser its open.

    This is my code 1 file:

    from selenium import webdriver
    
    
    class Objects:
        def __init__(self):
            self.driver = webdriver.Firefox()
    
        def open_page(self, url):
            return self.driver.get(url)
    

    And in my second file I have:

    from Objects.pom import Objects
    
    
    driver = Objects()
    base_url = {
        'eci_es' : 'url1',
        'eci_pt' : 'url2',
        'nw_back_rc' : 'url3',
        'wm_back_rc' : 'url4'
    }
    
    
    def login():
        driver.open_page(base_url.get('nw_back_rc'))
    

    But just the browser it's open.

    I will try to use POM



  • When you call driver = Objects(), it will instantiate the browser (self.driver = webdriver.Firefox()).

    But on the second script you just define a function that will call driver.open_page. You will need to call the function itself.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2