Вы находитесь на странице: 1из 6

Core Java Topics

1) How a java program work


a. Compiler – compiles the code and generate .class file
b. Interpreter – reads the .class file and convert into machine level language
c. JVM(Java Virtual Machine)
2) Packages
3) Class, Objects
4) Explanation of main method
5) Importing a package
6) Methods – return types, parameterized methods. Static method
7) Calling of method using object.
8) Calling of static method
9) Data types – boolean, int, long, float, double
10) Difference between data types.
11) Wrapper Class – Boolean, Integer, Long, Float, Double
12) Data conversion – int to String and vice versa
13) Type Casting – Implicit and Explicit type casting
14) Value data types and Reference data types
15) String operations
a. Substring
b. Equals
c. Contains
d. Length
e. Split
f. LastIndexOf
g. ToUpper
h. ToLower
i. Concat
j. Replace
k. Trim
16) Difference between String and StringBuilder
17) Use of static data types
18) Scope of variables
19) Constructor – Default and parameterized constructor
20) Calling of constructor.
21) Use of “this” keyword in constructor and in method
22) If-else statement
23) If-else-if statement
24) Switch case
25) Loops
a. For loop
b. While loop
c. Do-While loop
d. For-Each loop
26) “Break” and “Continue” keyword
27) Collections
a. Array
b. ArrayList
c. HashTable
d. HashMap
OOPS Concepts
1) Inheritance
a) Single Inheritance
b) Multilevel Inheritance
c) Hierarchical Inheritance
2) Use of “super” keyword in constructor
3) Constructor chaining
a) which constructor is called in inheritance in case of default constructor
b) use parametrized constructor in inheritance
4) Access Modifiers for methods
a) Public
b) Private
c) Protected
d) Default
5) Access Modifiers for constructor
6) Access Modifiers for Class(public, Private and default)
7) Why Multiple inheritance not supported
8) Polymorphism
a) Overloading
b) Constructor Overloading
c) Overriding
d) Base class=Child class reason
e) Why not Child class=Base class
f) Calling method in overriding
9) Use of “final” keyword to supress overriding
10) Abstract class
11) Interface
12) Inheritance in Interface
13) Difference between Abstract Class and Interface
14) Multiple Inheritance using Interface
15) Abstraction
16) Encapsulation
Selenium
1) Introduction of Selenium Webdriver architecture
2) Launch browser
a) Mozilla Firefox - Marionette and geckodriver
b) IE – IE settings, ie.driver, IEDriverServer
c) Chrome – chrome.driver, chromedriver
3) Browser Commands
a) driver.get(“url to navigate”) – navigate to URL
b) driver.getTitle() – get the browser title
c) driver.getCurrentURL() – get the URL of the current focused tab
d) driver.close() – close the instance of browser which has focus on
e) driver.quit() – close all the instance of browser
4) Navigation Commands
a) driver.navigate().to(“url to navigate”) – navigate to URL
b) driver.navigate().forward() – navigate to forward page in browser
c) driver.navigate().back() – navigate to back page of browser
d) driver.navigate().refresh() – refresh the browser
5) Difference between driver.get() and driver.navigate().to – former one waits for page load
6) Difference between driver.close() and driver.quit()
7) Maximize window browser
driver.manage().window().maximize();
8) Locator
a) Id
b) Name
c) className
d) cssSelector
e) linkText
f) partialLinkText
g) tagName
h) xpath
9) WebElement commands
a) General commands
i) WebElement.isDispalyed() – verify element is displayed on page or not(return true or false)
ii) WebElement.isEnabled() – Verify element is enabled
iii) WebElement.getText() – get the text of element
iv) WebElement.getTagName() – get the tag name of element
v) WebElement.getCssValue() – get the css value of element
vi) Webelement.getAttribute() – get the attribute value of element
b) Textboxes commands
i) WebElement.sendkeys(“texttotype”) – Types the text in textbox or textarea
ii) WebElement.clear() – clear the text from textbox or textarea
c) Button commands
i) WebElement.click() – mouse left click on element

10) Select checkbox or Radiobutton


public void ToggleCheckboxOrRadiobutton(boolean isSelect)
{
if(checkboxOrRadioButton.isSelected()!=isCheck)
PublishInRSSFeedCheckbox().click();

}
11) Select value from Dropdown
a) dropdownElement.selectByIndex()
b) dropdownElement.selectByValue()
c) dropdownElement.selectByVisibleText()
12) XPath
a) By.Xpath(“//tagname[@attributename=’value’]”)
b) By.Xpath(“//tagname[@attribute1=’value’ AND @attribute2=’value’]”)
c) By.Xpath(“//tagname[@attribute1=’value’ OR @attribute2=’value’]”)
d) By.Xpath(“//tagname[text()=’textofElement’]”)
e) By.Xpath(“//tagname[starts-with(@attributename,’value’)]”)
f) By.Xpath(“//tagname[starts-with(text(),’textoftag’)]”)
g) By.Xpath(“//tagname[contains(@attributename,’textOfElement’)]”)
h) By.Xpath(“//tagname[contains(text(),’textOfElement’)]”)
i) By.Xpath(“//tagname[ends-with(@attributname,’value’)]”)
j) By.Xpath(“//tagname[ends-with(text(),’vlaue’)]”)
k) By.Xpath(“//preceding-sibling::tagname[@attribute=’value’]”)
l) By.Xpath(“//following-sibling::tagname[@attribute=’value’]”)
m) By.Xpath(“//ancestor::tagname[@attribute=’value’]”)
n) By.Xpath(“..”) – immediate parent
13) Use of JavascriptExecutor
a) Click using JavascriptExecutor
WebElement aa= fDriver.findElement(By.xpath("//img[@src='images/frames_windows.jpg']"));
JavascriptExecutor executor = (JavascriptExecutor)fDriver;
executor.executeScript("arguments[0].click();", aa);
b) Sendkeys using JavascriptExecutor
WebElement searchbox = driver.findElement(By.xpath("//input[@name='q']"));
JavascriptExecutor myExecutor = ((JavascriptExecutor) driver);
myExecutor.executeScript("arguments[0].value='text to type in textbox';", searchbox);
14) Handling Alert popup
a) Click Cancel button
driver.switchTo().alert().dismiss();
b) Click OK button
driver.switchTo().alert().accept();
c) Get Alert popup message
driver.switchTo().alert().getText();
d) To type some text in alert popup message
driver.switchTo().alert().sendKeys("text to enter");
15) Press Modifier keys/Functional keys/Tab/Alt/End/Home etc.
a) Key Combination
Eg-: Press Ctrl+A
driver.findElement(By("//body")).sendKeys(Keys.chord(Keys.CONTROL, "t"));
b) Single Key
Eg-: Press F5
driver.findElement(By("//body")).sendKeys(Keys.chord(Keys.F5));
16) Switch to tab or window
String currentWindowHandle= fDriver.getWindowHandle();
for(String windowHandle : fDriver.getWindowHandles())
{
if(!windowHandle.equals(currentWindowHandle))
{
fDriver.switchTo().window(windowHandle);
}
}
17) Switch to frame
a) Switch to the frame defined
WebElement frame1=fDriver.findElement(By.className("demo-frame"));
fDriver.switchTo().frame(frame1);
b) In case of nested frame Switch to the parent frame
fDriver.switchTo().parentFrame();
c) Switch to the page containing the frame
fDriver.switchTo().defaultContent();
18) Action Class
a) Move To Element
Actions actions=new Actions(driver);
actions.moveToElement(elementToPerformOperation);
Action act=actions.build();
act.perform();
b) Left Click
Actions actions=new Actions(driver);
action.moveToElement(elementToPerformOperation).click();
Action act=actions.build();
act.perform();
c) Right Click
Actions actions=new Actions(driver);
actions.contextClick(elementToPerformOperation );
Action act=actions.build();
act.perform();
d) Double Click
Actions actions=new Actions(driver);
actions.doubleClick();
Action act=actions.build(elementToPerformOperation);
act.perform();
e) Type Text
Actions actions=new Actions(driver);
actions.sendKeys(elementToPerformOperation,”text to type” );
Action act=actions.build();
act.perform();
f) Press Key Combination
Actions actions=new Actions(driver);
actions.keyDown(Keys.CONTROL).sendKeys("t").keyUp(Keys.CONTROL);
Action act=actions.build();
act.perform();
g) Perform series of Command
Actions actions=new Actions(driver);
WebElement womenPageIndicator=driver.findElement(By.className("navigation_page"));
WebElement searchTextbox=driver.findElement(By.id("search_query_top"));
actions.doubleClick(womenPageIndicator)
.keyDown(Keys.CONTROL).sendKeys("c").keyUp(Keys.CONTROL)
.contextClick(searchTextbox)
.sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_D
OWN).sendKeys(Keys.ARROW_DOWN)
.sendKeys(Keys.ENTER);
Action act=actions.build();
act.perform();
h) Drag and Drop
WebElement source=driver.findElement(By.id("draggable"));
WebElement target=driver.findElement(By.id("droppable"));
Actions actions=new Actions(driver);
actions.dragAndDrop(source, target);
Action act=actions.build();
act.perform();
i) Drag and drop to a certain point
Actions actions=new Actions(driver);
actions.dragAndDropBy(driver.findElement(By.id("draggable")),50,50);
Action act=actions.build();
act.perform();
Note: 50, 50 is the offset from the source element
j) Resize(click hold->move mouse->Release)
Actions actions=new Actions(driver);
actions.clickAndHold(elementToHoldToDragForResize).moveByOffset(100, 100).release();
Action act=actions.build();
act.perform();
19) Wait
a) Implicit wait
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Note: If element is not found in 10 seconds will throw ElementNotVisibleException
Declared at driver level and applicable to all the elements associated with that driver.
b) Explicit Wait
WebDriverWait wait=new WebDriverWait(fDriver,20);
WebElement
droppableLink=wait.until(ExpectedConditions.elementToBeClickable(fDriver.findElement(By.linkText(
"Droppable"))));
c) Fluent Wait

Вам также может понравиться