Open turkogluc opened 6 years ago
I am trying to send a login form. When form have a <input type="submit"> finding the element and using elem.Click() works. However with the following form which includes a button instead input tag:
<input type="submit">
<form action="/bwapp/login.php" method="POST"> <p><label for="login">Login:</label><br /> <input type="text" id="login" name="login" size="20" autocomplete="off"></p> <p><label for="password">Password:</label><br /> <input type="password" id="password" name="password" size="20" autocomplete="off"></p> <p><label for="security_level">Set the security level:</label><br /> <select name="security_level"> <option value="0">low</option> <option value="1">medium</option> <option value="2">high</option> </select> </p> <button type="submit" name="form" value="submit">Login</button> </form>
And here is my code
func (cd *chromeDriver) login(url string){ // Navigate to the simple playground interface. if err := cd.webDriver.Get(url); err != nil { log.Println("PANIC:",err) } // Find all Forms forms, err := cd.webDriver.FindElements(selenium.ByXPATH,"//form") if err != nil { panic(err) } var text string for _,form := range forms{ inputs,err := form.FindElements(selenium.ByXPATH,"//input") if err != nil { log.Println("input could not be found",err) } for _,input := range inputs{ InputName,err := input.GetAttribute("name") if err != nil { log.Println("input name could not be found",err) } InputType,err := input.GetAttribute("type") if err != nil { log.Println("input type could not be found",err) } if InputType == "text" || InputType == "password"{ fmt.Print(InputName,":") fmt.Scanln(&text) input.SendKeys(text) } } button, err := form.FindElement(selenium.ByTagName,"button") if button == nil{ button, err = form.FindElement(selenium.ByXPATH,"//input[@type='submit']") if err != nil { log.Println(err) } err = button.Click() if err != nil { log.Println(err) } }else{ s,_ := button.Text() fmt.Println(s) //err = button.Click() err = button.Submit() if err != nil { log.Println(err) } } }}
for this case when I face with a neither click nor submit doesnt help. With Click I am getting the error: unknown error: unknown error: Element <button type="submit" name="form" value="submit">...</button> is not clickable at point (124, 570). Other element would receive the click: <p>...</p> And submit does not react at all except it resets the value of form inputs that I already filled. So please let me know if I am doing something wrong
unknown error: unknown error: Element <button type="submit" name="form" value="submit">...</button> is not clickable at point (124, 570). Other element would receive the click: <p>...</p>
I have the same problem.
I am trying to send a login form. When form have a
<input type="submit">
finding the element and using elem.Click() works. However with the following form which includes a button instead input tag:And here is my code
for this case when I face with a