ADHD診断済みアラサーが、1年後に海外移住を成功させるブログ

2023年6月を目標にロンドン移住を実現させます

テスト自動化メモ

夏休み前半に勉強したテスト自動化の内容をまとめます

使用したUdemy教材

www.udemy.com

Interface in Java

-Interface is a group of related method with empty body.

-Interface enforces contract to class to follow.

  • WebDriver driver = new ChromeDriver();

Web driver is an interface that Chrome driver is implementing. And we want to refer only web driver-implemented methods.

  • ChromeDriver driver = new ChromeDriver();

This code might not work in other browsers if this driver is accessing the personal chrome driver class method.

Stringとは

×文字列

○文字列を表す参照型の型(object that represents a sequence of characters.)

Stringの定義

(1)String 変数名 =new String("A");

 文字列が同じでもnewを付ければいくつでも作れる

(2)String 変数名="A";

 文字列が同じであれば変数は一つ。メモリ領域を有効に使える。

メモリについてはここがわかりやすかった↓

java:参照型変数やメモリの理解に苦しむ若手Java技術者に向けて – サイゼントの技術ブログ

methodの違い

-driver.close:close current window

-driver.quit: quit all the windows which opened by automation

String[] name = {"A", B", "C"};

for(int i =0; i<name.length;i++)

{

System.out.println(name[i]);

}

As is: for (int = 0; i<s.length(); i++)

Reverse: for (int i = s.length()-1;  i>=0; i--)

 

Selenium Web Driver Locators

<input type="text" placeholder="Username" id= “inputUsername  value=" ">

Input -> tag name

Red-> attribute

Green-> attribute associated value.

 

CSS selector

Xpath 

CSSの場合 Parenttagname childtagname body header(スペース入れる)

 

When would you see the element "intercept"?

When the app is in changing state from one view to another, you might run into that interception error.

At that time, you must wait until that view get stable.

 

Implicit wait

waiting for objects to show on the page.something to show 

something to get in a stable state.

★implicit wait vs thread.sleep

stackoverflow.com

Identify the elements with the help of partial text, by using  the star

input[type*='pass' ]

css

${input[type*="pass"]}