hi to everyone,
can help please?
_when i run my robotframework test case to open a goolge search, the browser opens with pop up terms and servides google to im accept.
How can i take off to my test?
ps:using PyCharm 2021.1.1 (Community Edition)
and robotframework 4.0.1
if not and you have permission to be automating the google site, then post the relevant lines from your robot file and the error you’re getting and which line is giving you a problem and someone here will try to help you.
Firstly you’re using Selenium2Library, this was deprecated quite a long time ago, you should use SeleniumLibrary to ensure you are using a library with all the current bug fixes.
Secondly, I mocked up a minimal test case that simulates you code example, it looks to me that problem is with the line:
Input Text id:input ${SEARCH_WORD}
When I checked the page html of http://google.pt, there were no html items that had an id of input.
Using name:q seemed to work better form me, so I suggest you read about Locating elements
I’m confused are you trying to type “http://www.google.pt” into the search field or the url bar? I was guessing you were trying to type something into the search field on the google page which is why I suggested name:q
FYI I just set ${SEARCH_WORD}= Raul, try to keep things simple at first till you get them working.
I don’t know why you keep getting that google notice dialogue but I not that it’s the same as what you get when you click the “Termos” link at the bottom right of the main page, so what I think is happening is your script is somehow accidentally clicking that.
Some thing to try:
open the site “http://www.google.pt” in chrome manually without robot framework
press F12 on your keyboard (opens dev tools)
select the console tab (might have a different name in Portuguese)
in the console type $x('//*[@id=="input"]') and press enter (this should return no results)
in the console type $x('//*[@name=="q"]') and press enter (this should return 1 result, the input field)
This at least will help figure out if the field’s html is the same in Portuguese, it’s not a language I know much of sorry.
Also as an FYI this is what worked for me (it was called Raul.robot):
*** Settings ***
# Library Selenium2Library
Library SeleniumLibrary
Test Setup Go to G
Suite Teardown Close All Browsers
*** Variables ***
${URL} http://google.pt
*** Test Cases ***
Simple example Search
Simple Search Raul
*** Keywords ***
Simple Search
[Arguments] ${SearchWord}
# Input Text id:input ${SearchWord}
# Press Keys id:input ENTER
Input Text name:q ${SearchWord}
Press Keys name:q ENTER
Go to G
Open Browser ${URL} Chrome
Maximize Browser Window
Sleep 5s
Hopefully this will get you on the path to finding an answer,