1

Hi I am using ghostdriver for selenium. I am trying to log into google adwords but for some reason I am having extreme issues.

Here is my code:

Dim driver As New PhantomJSDriver
    Dim options = New PhantomJSOptions()
    options.AddAdditionalCapability("phantomjs.page.settings.userAgent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36")

    driver.Navigate.GoToUrl("https://accounts.google.com/ServiceLogin?service=adwords&continue=https://adwords.google.com/um/identity?dst%3D/ko/KeywordPlanner/Home&hl=en_US&ltmpl=signin&passive=0&skipvpage=true#identifier")

    driver.Manage.Window.Maximize()

    Dim i As IWebElement = driver.FindElementByName("Email")
    Dim a As New Actions(driver)

    a.MoveToElement(i).Click().Perform()

    Dim jse As IJavaScriptExecutor = DirectCast(driver, IJavaScriptExecutor)
    jse.ExecuteScript("document.getElementById('Email').focus();")



    Dim nextbtn As IWebElement = driver.FindElementById("link-signup")
    nextbtn.Click()

    Try
        Dim ss As Screenshot = DirectCast(driver, ITakesScreenshot).GetScreenshot()
        ss.SaveAsFile("D:\SeleniumTestingScreenshot.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
    Catch

    End Try

As you can see it's a very straightforward process. The issue is that everything is grayed out on the page (I have checked via screenshot). It's as if something isn't properly loading on the page and causing the textbox or buttons or links to become active. I cannot click on ANYTHING. I have tried many different things but nothing is working for me. Javascript is enabled, I have changed the user agent in case the phantomjs one is being blocked. Any help to this issue would be appreciated. I can work with c# or vb.net it doesn't matter. I have a feeling Google is being tricky here.

Zach Johnson
  • 2,047
  • 6
  • 24
  • 40
  • Sounds like an infinite loop clientside. Can you debug the javascript? – user3532232 Jul 15 '16 at 21:17
  • one thing you could try that would shed some light on the subject is to see if you can log in via another google service such as mail or photos or analytics. I bet you are right, it kind of makes sense to detect and block bots on a login page. – Rob Allen Jul 15 '16 at 21:22

1 Answers1

1

I believe I solved the problem here. It's quite simple and I feel stupid for not seeing it sooner. It seems like everything is just triggered so FAST things do not have time to properly load. So I added in a simple threading.thread.sleep command in between actions and things seem to be working fine now. Everything was greyed out because it was snapping a screenshot before the elements could load properly.

Zach Johnson
  • 2,047
  • 6
  • 24
  • 40
  • 2
    it's funny, there is a bot guard script on the page, but perhaps it detects other stuff. It says, /* Anti-spam. Want to say hello? Contact (base64) Ym90Z3VhcmQtY29udGFjdEBnb29nbGUuY29t -> botguard-contact@google.com – Rob Allen Jul 15 '16 at 21:30
  • 1
    Please don't forget to come back and mark the answer as accepted so the question get marked as answered. Thanks! – JeffC Jul 16 '16 at 05:12