I'm trying to go to a LinkedIn website. I'm using Selenium and for some reason it does not recognize my saved user name and password so every time I open up a LinkedIn session, it is prompting me for those, but first since I already have an account, I have to click the Sign In 'button.' I'm pretty new to Selenium and not sure how to reference the web element.
This is a shortened version of the URL I get tripped up on: https://tinyurl.com/ygyw7eeo
This is a portion of what I think is the relevant HTML: Sign in
What I need is the VBA code to recognize that element and click "Sign Up" to take me to the next page where I input my email and password, then hit the Login button.
I've spent days on this and no idea so any help would be greatly appreciated. Thanks.
Private Sub Command175_Click()
Dim SeleniumEdgeDriver As New EdgeDriver
Dim strEdgeProfile As String
Dim SignInButton As Variant
'strEdgeProfile = "C:\Users\Jerry\AppData\Local\Microsoft\Edge\User Data\Personal"
strEdgeProfile = "C:\Users\Jerry\AppData\Local\Microsoft\Edge\User Data\Profile 1"
'.AddArgument ("profile-directory=foldername") 'foldername is the name of the folder with the profile you want to use
SeleniumEdgeDriver.SetProfile strEdgeProfile, True
SeleniumEdgeDriver.AddArgument ("--user-data-dir=C:\Users\[NAME]\AppData\Local\Microsoft\Edge\User Data\Default")
SeleniumEdgeDriver.AddArgument ("profile-directory=C:\Users\[NAME]\AppData\Local\Microsoft\Edge\User Data\Default")
SeleniumEdgeDriver.Get ("http://www.google.com")
SeleniumEdgeDriver.Get ("https://www.linkedin.com/feed/")
'Wait for the page to load code
While SeleniumEdgeDriver.ExecuteScript("return document.readyState") <> "complete"
SeleniumEdgeDriver.Wait (5000)
Wend
'Click the Sign in button-All of the commented out things are what I've tried that didn't work!
'I tried to set my user profile where the login name and password were stored and that is not working
"I also tried to code to click the sign in button and that is not working becuase I'm not properly referecing the object
'SignInButton = SeleniumEdgeDriver.FindElementByName("auth_wall_desktop_profile-login-toggle")
'SignInButton.Click
'SeleniumEdgeDriver.FindElement(By.linktext("Sign in")).Click
'SeleniumEdgeDriver.FindElementByLinkText("Sign in").Click
'SeleniumEdgeDriver.FindElementByXPath("//button.form-toggle").Click
'SeleniumEdgeDriver.FindElementsByXPath("/html/body/main/div/div/form[2]/section/p/button").Click
'SignInButton = SeleniumEdgeDriver.FindElementsByXPath("/html/body/main/div/div/form[2]/section/p/button", 100, 100)
'SignInButton.Click
'SeleniumEdgeDriver.FindElementByClass("form-toggle", 2000).Click
'SeleniumEdgeDriver.FindElementById("auth_wall_desktop_profile-login-toggle", timeout:=0).Click ' no implicit waiting
'SeleniumEdgeDriver.FindElementByXPath("//a[@class='challenge-dialog']").Click
'SeleniumEdgeDriver.FindElementsByClass("p").Attribute("form-toggle").Click
'driver.FindElement (By.cssSelector("#shipping-method-buttons-container button"))
'SeleniumEdgeDriver.FindElementByCss("profile-card hidden").Click
'SeleniumEdgeDriver.FindElementByTag("Button", 2000, False).Click
'SeleniumEdgeDriver.FindElementByXPath("//div[@class ='data-tracking-control-name']/button/span/span[text()='Sign in']").Click
'SeleniumChromeDriver.Manage().DeleteAllCookies
SeleniumEdgeDriver.window.Maximize
SeleniumEdgeDriver.Wait 12000
SeleniumEdgeDriver.Quit
End Sub