Discussion:
How to use By.ByClassName?
Raju
12 years ago
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
12 years ago
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
12 years ago
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..
...
--
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
12 years ago
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
...
--
*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...