How to read or copy data from second email in Yopmail - selenium

I'm trying to read or switch frame to second email content in yopmail but I'm not able to switch frame, I used switch frame with Index, Id, and xpath getting no such frames found, and when I tried to print frame size getting 0, but in inspect element I'm seeing 3 frames. Can some one please help me to get out of this problem. When I'm trying to select second email content it's giving no such element found error and to second email content also I'm not able to switch.
I'm expecting to select second email content using Java
You can use this email address - Secondemail1234#yopmail.com
Step 1 - Open yopmail and enter email address
Step 2 - Click second email
Step 3 - get text from second email body

Related

Using send_keys() on a search/filter input field does not filter results in table

There is a table with a list of users and their email on a webpage. At the top of the page, is a search/filter input field that allows the user to type an email or username and filter for the result as he/she is typing.
The problem: However, when I use the send_keys() method instead of doing this manually, nothing is filtered in the table view.
This is happening on the Safari browser on the iPhone 7 Plus (real device, not simulator). Some other information:
iOS version: 12.2
Appium version: 1.13.0-beta.3
Selenium version: 2.53.1
Programming language: Python 2.7.15
In addition to send_keys(), i've tried to use set_value(), i've also tried to execute JS and setting the attribute value, and also tried to send key for each character (in a for loop with a delay between each character).
I'm expecting for example, element.send_keys("test1000#test.com) to filter the table view on the web page so that the only user that is displayed has the associated test1000#test.com email as it does when I go through the site manually.
In actuality, send_keys() does not do that and nothing in the table view gets filtered.
Any help or guidance would be appreciated!
Explicit wait for table to get populate in DOM
sendKeys search String and additional key Tab
textbox.sendKeys("test1000#test.com"+Keys.TAB)
Explicit Wait for filter to get applied and table to get refreshed.
find elements for the newly populated table with applied filters.

Can't pass a Test Execution result to a variable in Robo Framework

I am posting the results of automated tests to an offline forum. It would be nice to include PASS/FAIL in the forum post title but I'm having some difficulties retrieving the ${TEST STATUS} value - (obviously a hard-coded value works fine) .
I've defined the following in common-variables.robot as:
${FORUM_TEST_RESULT}....${TEST STATUS}
then on publish-results.robot
Input Text....//*[#id="title"]....${FORUM_TEST_RESULT}
The error I get is: variable ${FORUM_TEST_RESULT} not found
I can see here: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#listener-interface that ${TEST STATUS} can only be used as part of Teardown.
I'm not sure how to collect the value of ${TEST STATUS} in the context of my RF script.
e.g the very last thing my script does is post to a forum:
Input Text....//*[#id="title"]....${FORUM_TEST_RESULT}
but before that I obviously need to populate ${FORUM_TEST_RESULT} with the value of ${TEST STATUS) which you can only get on Teardown? Hope this makes sense.
Input Text is a keyword of Selenium2Library that types the given text into the text field of a web page. You need to start a browser session first and open the right page an then possibly wait for the element to become visible, for example like this:
Open Browser [URL of your site]
Wait Until Element Is Visible //*[#id="title"]
Input Text //*[#id="title"] ${FORUM_TEST_RESULT}
If you want to retrieve a text from a page (as your coment suggests) then you need to use the keyword Get Text which returns the text of the element identified by locator.
Get Text locator

How to Select Choices input field having same class, type, Xpath everything is same

I have two input fields to enter choices which have same class, type. Id is different by it is dynamic and create on run time so i can't use id.I used indexing ,it's not working properly.
driver.findElement(By.xpath("//input[#type='text'][#placeholder='Provide a response entry that customers can select'][1]")).click();
driver.findElement(By.xpath("//input[#type='text'][#placeholder='Provide a response entry that customers can select'][1]")).sendKeys("Iphone 6");
driver.findElement(By.xpath("//input[#type='text'][#placeholder='Provide a response entry that customers can select'][2]")).click();
driver.findElement(By.xpath("//input[#type='text'][#placeholder='Provide a response entry that customers can select'][2]")).sendKeys("Iphone 7");
I used indexing in given image link.
click link to view code in organized way
Index 1 works in this case but unable to find index 2.
Given inspected html code is below of input field 1 and field 2
Field 1
Input field 1 image Xpath link
field 2
Input field 2 image link
If these two inputs are always in this sequence (so the first input is always first and second always second)
You can use:
driver.findElement(By.xpath("(//input[#type='text'][#placeholder='Provide a response entry that customers can select'])[1]")).click();
driver.findElement(By.xpath("(//input[#type='text'][#placeholder='Provide a response entry that customers can select'])[2]")).click();
At the same time I have corrected the syntax in indexing
Building on #Anand 's answer, you can simplify a little:
WebElement button1 = driver.findElement(By.xpath("(//input[#type='text' and #placeholder='Provide a response entry that customers can select'])[1]"));
WebElement button2 = driver.findElement(By.xpath("(//input[#type='text' and #placeholder='Provide a response entry that customers can select'])[2]"));
I think it's a little easier to read using and instead of stacking brackets.
I use it similarly for widgets:
WebElement header = driver.findElement(By.xpath("//div[contains(#class,'panel')]/div[contains(#class,'panel-heading') and text()[contains(.,'News Feed')]]"));

Need to capture ID after clicking on submit button

I am using selenium with java and In my application , whenever I click on submit button, system generates random ID, I need to capture that ID displayed on screen(a div) and then put in other field to ensure, all fields are filled and we are able to edit as well.
The simpelst way is this:
Create a variable that will contain the id:
String myID;
After id is created you need to capture the text in the filed:
myID = driver.findElement(By.id(".....")).getText();
After this, the ID will be saved in myID.
to see if it worked, run the following line:
System.out.println(myID);
If the output in the console is the same as in a generated ID field then all worked correctly.

Storing dynamic text in Selenium

I'm new to Selenium and had the following question about storing dynamic text...
In our web application, when a function is performed (i.e. transfer), a confirmation message is displayed (i.e. "function is completed. The reference number is #12345". The ref number is then displayed in a list with other ref numbers on another page. As part of my test, after the ref. number is generated, I would like to select from the list the ref number that was just generated.
Example
1 create item.
2 confirmation message displays
3 save ref number
4 navigate to other page which contains list of ref #s
5 select item from list that was just created (select using ref #)
Question: How do I save the ref number from the confirmation message so that I have Selenium select that number from the list of ref #'s?
Thanks,
D
Find out the identifier (CSS/XPath/etc.) of the UI element that displays the reference number, and then use the relatively getText() command. In Java,
String text = selenium.getText("your_identifier");