Discussion:
How to use By.ByClassName?
Raju
2013-04-30 06:08:12 UTC
Permalink
Hi All,

I would like to know how to use By.ByClassName?

Generally we use By.id("p1006ICGdrawingDiv-NoEdit") some thing like this...

Can any one tell me how to use By.ByClassName ...?

Thanks,
Naga
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
sourabh
2013-04-30 06:32:39 UTC
Permalink
Hi Nagaraju,

In place of ByClassName , you can use By.className. In this method you can
pass the name of css class. Also you can use By.cssSelector .
Below is the documentaion of the function -

[image: Open Declaration]<eclipse-open:%E2%98%82=Genie/C:%5C/Automation%5C/Genie%5C/libs%5C/Blade-2.0-jar-with-dependencies.jar%3Corg.openqa.selenium(By.class%E2%98%83By~className~Ljava.lang.String;>
By<eclipse-javadoc:%E2%98%82=Genie/C:%5C/Automation%5C/Genie%5C/libs%5C/Blade-2.0-jar-with-dependencies.jar%3Corg.openqa.selenium(By.class%E2%98%83By~className~Ljava.lang.String;%E2%98%82By>org.openqa.selenium.
By<eclipse-javadoc:%E2%98%82=Genie/C:%5C/Automation%5C/Genie%5C/libs%5C/Blade-2.0-jar-with-dependencies.jar%3Corg.openqa.selenium(By.class%E2%98%83By>
.className(String<eclipse-javadoc:%E2%98%82=Genie/C:%5C/Automation%5C/Genie%5C/libs%5C/Blade-2.0-jar-with-dependencies.jar%3Corg.openqa.selenium(By.class%E2%98%83By~className~Ljava.lang.String;%E2%98%82String>className)


- className

public static By <../../../org/openqa/selenium/By.html> className(java.lang.String className)

Finds elements based on the value of the "class" attribute. If an
element has many classes then this will match against each of them. For
example if the value is "one two onone", then the following "className"s
will match: "one" and "two"
Parameters: className - The value of the "class" attribute to search for
Returns: a By which locates elements by the value of the "class"
attribute.


Thanks
Sourabh
Post by Raju
Hi All,
I would like to know how to use By.ByClassName?
Generally we use By.id("p1006ICGdrawingDiv-NoEdit") some thing like this...
Can any one tell me how to use By.ByClassName ...?
Thanks,
Naga
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/6lTyG2YgoRgJ.
For more options, visit https://groups.google.com/groups/opt_out.
Raju
2013-04-30 06:38:16 UTC
Permalink
Hi Sourabh,

Thanks for the reply. Actually i am using By.className...just curious to
know By.ByClassName. If possible can you give a practical example for
By.ByClassName..
Post by sourabh
Hi Nagaraju,
In place of ByClassName , you can use By.className. In this method you
can pass the name of css class. Also you can use By.cssSelector .
Below is the documentaion of the function -
Open Declaration
<eclipse-open:%E2%98%82=Genie/C:%5C/Automation%5C/Genie%5C/libs%5C/Blade-2.0-jar-with-dependencies.jar%3Corg.openqa.selenium%28By.class%E2%98%83By%7EclassName%7ELjava.lang.String;>By
<eclipse-javadoc:%E2%98%82=Genie/C:%5C/Automation%5C/Genie%5C/libs%5C/Blade-2.0-jar-with-dependencies.jar%3Corg.openqa.selenium%28By.class%E2%98%83By%7EclassName%7ELjava.lang.String;%E2%98%82By>
org.openqa.selenium.By
<eclipse-javadoc:%E2%98%82=Genie/C:%5C/Automation%5C/Genie%5C/libs%5C/Blade-2.0-jar-with-dependencies.jar%3Corg.openqa.selenium%28By.class%E2%98%83By>.className(String
<eclipse-javadoc:%E2%98%82=Genie/C:%5C/Automation%5C/Genie%5C/libs%5C/Blade-2.0-jar-with-dependencies.jar%3Corg.openqa.selenium%28By.class%E2%98%83By%7EclassName%7ELjava.lang.String;%E2%98%82String>
className)
*
className
public staticBy <../../../org/openqa/selenium/By.html> className(java.lang.String className)
Finds elements based on the value of the "class" attribute. If an
element has many classes then this will match against each of
them. For example if the value is "one two onone", then the
following "className"s will match: "one" and "two"
|className| - The value of the "class" attribute to search for
a By which locates elements by the value of the "class" attribute.
Thanks
Sourabh
Hi All,
I would like to know how to use By.ByClassName?
Generally we use By.id("p1006ICGdrawingDiv-NoEdit") some thing like this...
Can any one tell me how to use By.ByClassName ...?
Thanks,
Naga
--
You received this message because you are subscribed to the Google
Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msg/selenium-users/-/6lTyG2YgoRgJ.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
SOURABH TIWARI
2013-04-30 06:49:12 UTC
Permalink
Hi Naga,

Actually By.ByClassName is a static class defined in By.java. Internally
By.className is returning an object of this class.

*return** new ByClassName(className);*

And i guess ByClass name class should be private.

Thanks
Sourabh
Post by Raju
Hi Sourabh,
Thanks for the reply. Actually i am using By.className...just curious to
know By.ByClassName. If possible can you give a practical example for
By.ByClassName..
Hi Nagaraju,
In place of ByClassName , you can use By.className. In this method you can
pass the name of css class. Also you can use By.cssSelector .
Below is the documentaion of the function -
[image: Open Declaration]By org.openqa.selenium.By.className(StringclassName)
- className
public static By <http://../../../org/openqa/selenium/By.html> className(java.lang.String className)
Finds elements based on the value of the "class" attribute. If an
element has many classes then this will match against each of them. For
example if the value is "one two onone", then the following "className"s
will match: "one" and "two"
Parameters: className - The value of the "class" attribute to search
for Returns: a By which locates elements by the value of the "class"
attribute.
Thanks
Sourabh
Post by Raju
Hi All,
I would like to know how to use By.ByClassName?
Generally we use By.id("p1006ICGdrawingDiv-**NoEdit") some thing like
this...
Can any one tell me how to use By.ByClassName ...?
Thanks,
Naga
--
You received this message because you are subscribed to the Google Groups
"Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msg/selenium-users/-/6lTyG2YgoRgJ.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the
Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/selenium-users/7ZZrkfj6Hh0/unsubscribe?hl=en-US
.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/groups/opt_out.
--
*Sourabh Tiwari*
*Mobile:* +91 80880 62429
*Email:* sourabhkt-***@public.gmane.org
*IM:* sourabhkt (Skype)
*Professional Profile<http://in.linkedin.com/pub/sourabh-tiwari-open-networker-5k-contacts/b/a5a/255>
*

Work hard. Have fun. Make history.
See who we know in
common<http://www.linkedin.com/e/wwk/35455457/?hs=false&tok=04z9CAvh0oF5s1>
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Loading...