Grab all text inside a container using Selenium c# - c#

I hope someone could help me out on this one. Basically i have this website that has a lot of dialog boxes. These dialog boxes are changed dynamically and they are not any means static content. My task is to grab all the text inside the dialog box, they might be a drop down menu (simple SELECT and OPTION) or it might contain radio button with text beside it, or even checkbox with text beside it etc.. But i need to find a way to GRAB everything inside a container id.
For example: www.facebook.com
The Notification box i only want the text inside that container how would i go about?
It's class id is
"uiScrollableArea fade uiScrollableAreaWithShadow contentAfter contentBefore"
Lets assume for our example the class id is uiScrollableAreaWithShadow.
Thanks.

You can do that by getting the WebElement or Select Object Text
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebElement.html
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/support/ui/Select.html

Related

Windows Forms Adding Text without Textbox

I am using Visual Studio 2019 in order to create a Windows Form Application. I need some titles in my application, which means these strings will not be modified by the user.
For now, I created textboxes for these titles and made these textboxes "read-only". However, this does not satisfy my aesthetical expectations.
Therefore, I wonder if there is a way to add a string without adding a textbox, to the form. Is there a way?
Thanks in advance :)
Consider using a Label control rather than a TextBox.
The only time I would use a TextBox as a label is if I want the user to be able to copy the info, and I make it borderless, readonly and have the same colour as the background of the form. It's not superb UX though as there isn't anything that screams "you can highlight and copy this text" other than an I beam cursor, which is pretty much "mystery meat navigation" - better off putting a copy button next to it if you expect the user to copy info often
Why not use Label for your titles?
Since label, by default, cannot be modified by the user, thats what you want. Textbox is used for the user input, not for the titles.
Use Label control that is the right control to use for your requirement

How do I make a custom pop up for when I click on an asp table element?

I have a table I've dynamically created, and I want to make it so that I see a pop up with a custom image, along with some text taken straight from the table element.
With the limited context you provide, I can't give you a complete solution, but I can at least outline a way to get it running:
Use jQuery and jQueryUI.
Bind a jQuery click event handler to the element.
Use a jQueryUI Dialog to display the popup.

Labels and events!

I have a question? How can I wire up an button in a winform to take an input from a label, and put it in a text box to display the result?
I'm confused!
I have 4 labels... I want to be able to have people put input into the labels click the update button, and then display the results in the textbox below.
Any help? Thank you!
OK so basic outline of what you need to do:
1) Go to the toolbox and put textbox(es) on the form for the user to type in.
2) Add at least one label for your output text
3) Add a Button
4) Select each item on the form, go to its properties (f4) and set the Name property for each one to something that you can remember (this is how you'll reference the controls in your code)
5) Double click on the submit button. This will open up an "Event Handler" for Button.Click, which means the code you write will run when someone clicks the button.
6) Write the C# code to do what you want. For instance, this takes the contents of a textbox (tbInput.Text) and copies it to the label text (lblOutput.Text):
lblOutput.Text = tbInput.Text;
Hope this helps...if not, read the first 3 or 4 chapters of any beginning C# book.
You don't put input input into label, you do that in a TextBox. A label is a as its name implies a "label" (fixed unmodifiable text).
Most simply, create a method to handle the Click event of the button, bind it in.
Inside this method get the text from the labels, and then update the textbox with the input.
.NET standard Labels are not the controls you are looking for. Labels are just that...text labels that do not provide for text input. What you want is a TextBox, which you will be able to find in the Visual Studio Toolbox.
If you want the look and feel of a Label, but the functionality of a TextBox, you can modify the TextBox properties accordingly (border style, background color, etc).
Drop a Button onto your form, and from the Designer if you double-click the button, a _Click event handler will be generated in your source file from which you can implement the code to do whatever it is you want to do.

How to create a menu similar to the Windows 7 Start Menu in WPF

I am contemplating having a menu in my WPF application that works in a similar way to the Windows 7 start menu.
In my mind, this means that I should make a user control that consitues a button. Clicking on the button will display a list box, and inside the list box it will be possible to search the items that are registered in the list box.
Would that be an advisable way of doing it or is it better to do something different such as changing the template of a menu control?
Thanks for any help, it is very much appreciated.
It seems you have the design already made up. Do exactly that! :) Create a button that when pressed, displays a panel that contains a list box and a text box. Tie an event to key presses in the text box that changes what the object bound to the list contains.
After that, it's just a SMOP!

how to implement a search box in c#

I want to implement a search box in a window form. In that window form, I have a few botton and a text box.
I want to support the use case when user enter a string in the search box and then we can find the that string and highlighted like firefox does. Is it hard to do this?
I googled and found this link that has the search box control. but I don't quite understand the code. If anyone is familiar with control.sendMessage, Could you please give me some help on understand that control.
here is the link:
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/a07c453a-c5dd-40ed-8895-6615cc808d91/
Thanks
There is no single WinForms or Windows control that provides this functionality. You need to break the problem down into parts:
1) Create a search box
I believe the link you give adds the "Search" cue to a textbox but doesn't add the search button(?) - if that is the case you'll want to combine the textbox with a new button in a user control.
SendMessage sends a message to a Windows control or Window. In this case it tells the textbox to display the "Search" cue. You need to do this because this behaviour is not exposed by the WinForms controls.
2) Work out how to highlight sections of the text
If you are just using the WinForms controls you'll need to use a RichTextBox control and work out how to change the background color at various points in the text.

Categories