Click LinkedIn share button using Robot framework selenium library - selenium

I am a newbie in using robot framework.I would like to click linkedin share button using selenium library. From my understanding linkedin share button is of type submit and value Share. can someone suggest how to use click element or click button for this. Thanks.

Here is a snippet to help you get started:
*** Settings ***
Library Selenium2Library
*** Test Cases ***
Click share
Open Browser
... url=https://put-your-link-here
... browser=googlechrome
Click Button Share
Just put the right URL there, choose the browser you want to use, and check the name of the button. You can give this a go saving it to a file test.robot, for example, and run it with:
pybot test.robot
From there, the Documentation is your best friend.

I found an answer to my question. Before clicking an element should make sure that the element is visible. So below is the code
Wait Until Element is Visible css=input[value="Share"]
Click Element css=input[value="Share"]

Related

How to get rid of google pop-ups while testing and navigation google url?

Every time I navigate to google through Selenium, I encounter this popup. I can't click on the search bar. Is there a way to close permanently this popup without using any JS alert method etc.?
I tried some extensions but it didn't work
Click the Lock button (🔒) on the top-left of the search box
Click on 'Cookies'
Make sure you're on 'allowed' and find anything on the lines of google.com
Click Block, Done and refresh the page
Additionally, you may want to try it first without the web-driver 'Chrome is being controlled by automated test software' mode, so open Google Chrome you way you usually would.

Clicking a 'homepage' link in robot framework

I am writing test scripts using the Robot Framework & Selenium2Library for testing a web application.
The problem I have right now is that after the user has logged in, my script does not click the 'homepage' link to proceed to the Homepage, the application just disappears and command prompt gives me 'passed' results.
I want the script to click the link and then proceed to the Homepage,This is my code:
ClickHomePage
Click Link xpath=//*[#href="itinerary.php"]
I would appreciate your help. Thank you!
I have seen things like this generally when running tests on selenium. They could be really fast. I sometimes have to use breakpoints and debugging if I really want to see things happening during the test.
Unless you have another line of code after clicking the link, that is where the execution will end. Therefore, if you do want to see the homepage you may need to include a line a code that interacts with the homepage or simply a wait statement after clicking the link.
Try this code another way.
*** Variable ***
${profile} https://web.facebook.com/xxx
*** Keywords ***
Click Profile
[Arguments] ${xpath}
Click Element ${xpath}
*** Test Cases ***
Go To ${profile}
Hope to help.

Does Selenium supports Rebellion UI?

I am trying to automate a website built in Rebellion UI. However, even if the button is found, Selenium is not able to click on it. Has anybody faced such issue before or has Any idea about it?
I clicked using usual click and double click both, the color of the button changes but the button is not being clicked by Selenium 2.0 (jar 2.45). Please help.

Automating "Browse" button event in Selenium

I need to automate the "Browse" button click from Selenium.
For this, I have tried
driver.findElement(By.xpath("//*[#id=\"dnn_ctr383_View_filename\"]")).click();
and
driver.findElement(By.cssSelector("Css path")).click();
Both gives me org.openqa.selenium.NoSuchElementException: Unable to locate element: exception.
I have seen this link here where the author suggest to use AutoIT, but in step 2, the script, the author has created is for IE. Can someone please suggest, how I can automate the "Browse" button click in firefox?
Any help is much appreciated.
Directly send the file path to the id, like so
driver.findElement(By.id("dnn_ctr383_View_filename")).sendKeys("C:\\path\\to\\file");
The above step is the answer for your first two steps
Click on Browse
Select a file to upload
For the third step(click upload), looking at the screen capture I do not see any button which says "Upload". So just click "Save" and I assume that your file will successfully get uploaded.
There are two things that u need to consider here:
Clicking the browser button: Usually handled by an alert or popup, if the driver is not able to find the element by xpath(which u have acquired from firebug or chrome's inspect element) you should consider looking for iframes in the page source. If an element is in a different frame altogether , u need to switch frames in order to find the element like this
WebElement frame = driver.findElementById("name_of_iframe");
driver.switchTo().frame(fr);
now you can find your element using xpath or css selector like u did. Once completed u can move out of the frame by:- driver.switchTo().defaultContent();
Uploading the file from desktop: Since selenium works only on the html in the browser session u invoked from the driver, it can't perform operations on your desktop.Once you are able to click the browser button u can use Auto it(works only on windows) or Sikuli(works with mac, linux, windows and even android) to simulate your events based on the position of your upload button.
Hope this helps

Selenium cannot click tab in magento module detail page

I'm trying to validate data using selenium version 1.0.9 in magento grid and its detail page.
First, I walked through Selenium IDE from login page to module detail page and click the tabs available there. Eventually, IDE generates PHP codes so I put the code into proper location.
Note: Here, I have clicked the two tabs so that the events get recorded into selenium IDE.
Then, I run the code from command prompt using following command:
phpunit --configuration /var/www/tests/phpunit_test.xml
I got the error (something like):
ERROR: Element //a[#id='test_tabs_form_section']/span not found.
I modified the code and tried to open the detail page before executing click to above link i.e. "test_tabs_form_section", I am getting same error.
Another strange this is if I verify any text of detail page and remove the code that calls click to module detail tabs, it is works, not sure why?
But I really want to open detail page and click to tab, get forms element values using xpath and validate the data.
Can somebody help me, please?
Any help or suggestion is highly appreciable!
Looking forward to hear from stackoverflow geeks!
Thanks
In case this helps anybody:
I found out more things work if firebug is active. This actually makes sense cause firebug will show the final DOM tree in all it's debugging screens, so it's possible selenium is now able to reconstruct the element path because firebug altered the internal DOM.
If something doesn't work with the default element selection created by Selenium IDE, try switching it over to xpath:id-relative. You're already using that in your question, so maybe you there's an even better selector or you will need to resort to using clickAt instead of click.