"I'm Feeling Lucky" button doesn't work on Mac OS with Firefox & Chrome browsers

Discussion in 'Other Courses & Certifications' started by _15703, Dec 14, 2017.

  1. _15703

    _15703 New Member

    Joined:
    Nov 14, 2017
    Messages:
    1
    Likes Received:
    0
    I tried to run below Selenium Webdriver program on MAC OS

    1. Launch the "Chrome or Firefox" browser.
    2. Go to "google.com"
    3. Click on "I'm Feeling Lucky" button.

    Firefox browser sample code1:
    =======================
    package seleniumWebDrv;

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.firefox.FirefoxDriver;


    public class SeleniumEx2 {

    // Main Method

    public static void main(String[] args) {

    System.setProperty("webdriver.gecko.driver", "./Driver/geckodriver");
    WebDriver driver = new FirefoxDriver();
    driver.get("https://google.com"); // Use get() method to launch website.
    driver.findElement(By.name("btnI")).click(); // Find the web element "btnI" and click
    }
    }

    Sample code1 Console Logs:
    ======================
    1513270258979geckodriver INFO geckodriver 0.19.1
    1513270258989geckodriver INFO Listening on 127.0.0.1:9360
    1513270259851mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-profile" "/var/folders/sb/lqf_02_x3fl5kvs7f30jqgdh0000gn/T/rust_mozprofile.FRAGMtrdMbeo"
    1513270260588Marionette INFO Enabled via --marionette
    2017-12-14 11:51:01.768 plugin-container[1382:27551] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x8403, name = 'com.apple.tsm.portname'
    See /usr/include/servers/bootstrap_defs.h for the error codes.
    1513270262334Marionette INFO Listening on port 51514
    1513270262415Marionette WARN TLS certificate errors will be ignored for this session
    1513270262509Marionette DEBUG Register listener.js for window 2147483649
    Dec 14, 2017 11:51:02 AM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: W3C
    1513270262633Marionette DEBUG Received DOM event "beforeunload" for "about:blank"
    1513270263475Marionette DEBUG Received DOM event "pagehide" for "about:blank"
    1513270263476Marionette DEBUG Received DOM event "unload" for "about:blank"
    1513270263627Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://www.google.com/"
    1513270264331Marionette DEBUG Received DOM event "pageshow" for "https://www.google.com/"
    1513270264588Marionette DEBUG Canceled page load listener because no navigation has been detected

    Expected Result:
    =============
    Google website should be launched in Firefox browser and should be clicked on "I'm Feeling Lucky" button.

    Issue:
    =====
    When I run the program below issues are observed,
    1. Firefox browser window launched at the background.
    2. Google website page is opened but it didn't click on "I'm Feeling Lucky" button.



    But when I tried to execute same steps in different scenario it worked fine. But there are few "Java Script Error" messages in Console log. Please refer below Sample code2 and respective console logs.

    Firefox browser Sample code2:
    =======================
    package seleniumWebDrv;

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.firefox.FirefoxDriver;

    public class SeleniumEx2 {
    // Main Method
    public static void main(String[] args) {

    System.setProperty("webdriver.gecko.driver", "./Driver/geckodriver");

    WebDriver driver = new FirefoxDriver();
    driver.get("https://google.com"); // Use get() method to launch website.
    WebElement searchBox = driver.findElement(By.id("lst-ib"));
    searchBox.sendKeys("linkedin");
    driver.findElement(By.name("btnI")).click(); // Find the web element "btnI" and click on "I m feeling lucky"
    button
    driver.navigate().back(); // click on "back" button.
    driver.navigate().refresh(); // click on "Refresh" button
    driver.navigate().forward(); // click on "Forward" button.
    driver.navigate().back(); // click on "back" button.
    driver.close(); // Close the browser.
    }
    }

    Sample Code2 Console logs:
    ======================
    1513270579259geckodriver INFO geckodriver 0.19.1
    1513270579268geckodriver INFO Listening on 127.0.0.1:33015
    1513270579915mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-profile" "/var/folders/sb/lqf_02_x3fl5kvs7f30jqgdh0000gn/T/rust_mozprofile.TRT70jUKsQBD"

    1513270580617Marionette INFO Enabled via --marionette
    2017-12-14 11:56:21.788 plugin-container[1400:29742] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x823f, name = 'com.apple.tsm.portname'
    See /usr/include/servers/bootstrap_defs.h for the error codes.

    1513270582812Marionette INFO Listening on port 52182
    1513270582842Marionette WARN TLS certificate errors will be ignored for this session
    1513270582929Marionette DEBUG Register listener.js for window 2147483649
    Dec 14, 2017 11:56:22 AM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: W3C
    1513270583055Marionette DEBUG Received DOM event "beforeunload" for "about:blank"
    1513270584033Marionette DEBUG Received DOM event "pagehide" for "about:blank"
    1513270584034Marionette DEBUG Received DOM event "unload" for "about:blank"
    1513270584180Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://www.google.com/"
    1513270584359Marionette DEBUG Received DOM event "pageshow" for "https://www.google.com/"
    1513270584449Marionette DEBUG Received DOM event "beforeunload" for "https://www.google.com/"
    1513270585530Marionette DEBUG Received DOM event "pagehide" for "https://www.google.com/"
    1513270585533Marionette DEBUG Received DOM event "unload" for "https://www.google.com/"

    JavaScript error: https://static.licdn.com/scds/conca...3fiwnzuwkt66sbxsu8f-di2z9sra5co9la7ogqyesywin, line 48: TypeError: c is null

    1513270585964Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://www.linkedin.com/"
    1513270586143Marionette DEBUG Received DOM event "pageshow" for "https://www.linkedin.com/"
    1513270586156Marionette DEBUG Received DOM event "beforeunload" for "https://www.linkedin.com/"
    1513270586186Marionette DEBUG Received DOM event "pagehide" for "https://www.linkedin.com/"
    1513270586187Marionette DEBUG Received DOM event "unload" for "https://www.linkedin.com/"
    1513270586284Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://www.google.com/"
    1513270586288Marionette DEBUG Received observer notification "outer-window-destroyed" for "2147483654"
    1513270586580Marionette DEBUG Received DOM event "pageshow" for "https://www.google.com/"
    1513270586594Marionette DEBUG Received DOM event "beforeunload" for "https://www.google.com/"
    1513270586818Marionette DEBUG Received DOM event "pagehide" for "https://www.google.com/"
    1513270586821Marionette DEBUG Received DOM event "unload" for "https://www.google.com/"
    1513270586921Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://www.google.com/"
    1513270587463Marionette DEBUG Received DOM event "pageshow" for "https://www.google.com/"
    1513270587479Marionette DEBUG Received DOM event "beforeunload" for "https://www.google.com/"
    1513270587786Marionette DEBUG Received DOM event "pagehide" for "https://www.google.com/"
    1513270587789Marionette DEBUG Received DOM event "unload" for "https://www.google.com/"

    JavaScript error: https://static.licdn.com/scds/conca...3fiwnzuwkt66sbxsu8f-di2z9sra5co9la7ogqyesywin, line 48: TypeError: c is null

    1513270587893Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://www.linkedin.com/"
    1513270587963Marionette DEBUG Received DOM event "pageshow" for "https://www.linkedin.com/"
    1513270587985Marionette DEBUG Received DOM event "beforeunload" for "https://www.linkedin.com/"
    1513270588001Marionette DEBUG Received DOM event "pagehide" for "https://www.linkedin.com/"
    1513270588002Marionette DEBUG Received DOM event "unload" for "https://www.linkedin.com/"
    1513270588082Marionette DEBUG Received DOM event "DOMContentLoaded" for "https://www.google.com/"
    1513270588087Marionette DEBUG Received observer notification "outer-window-destroyed" for "2147483659"
    1513270588378Marionette DEBUG Received DOM event "pageshow" for "https://www.google.com/"
     
    #1
  2. blbokeb

    blbokeb Active Member

    Joined:
    Mar 19, 2018
    Messages:
    32
    Likes Received:
    0
    Oh yeah
     
    #2

Share This Page