Wednesday, March 30, 2022

Selenium WebDriver Browser Commands PART - 2

 Get Commands

  • Get commands are used to collect various information about the page that we deal with here are some important “get” commands.

1. Get-Command  - get()

  •      get() command is used to open a new browser window and it will find/fetch the page that you have given.

2. Get Title Command - getTitle() 

  • getTitle() is used to get the title of the current page.

3. Get Current URL Command -  getCurrentUrl() 

  • This command is used to get the current URL of the browser.

4. Get Page Source Command –  getPageSource() 

  • This command is used to get the source code of the page.

5. Get Text –  getText() 

  • This command is used to fetch the text of the element.

NAVIGATE COMMANDS

1. Navigate To Command–  navigate().to() 

  • This command is like Get() command.
  • It opens a new browser window and it will find/fetch the page that you have given.

2. Navigate Refresh Command–  navigate().refresh() 

  • This command is used to refresh the current page.

3. Navigate to the back page–  navigate().back() 

  • This command is used to go back by one page in the browser’s history.

4. Navigate to the forward page–  navigate().forward() 

  • Takes you forward by one page on the browser’s history.

5. Refresh page –  navigate().refresh() 

  • It refreshes the current page.

 

OTHER USEFUL COMMANDS


1. switch to command – ” driver.switchTo().window(“windowName”) ”

  • This command is used to switch from one window to another.

2. Switching  from one iframe to another – ” driver.switchTo().frame(“frameName”) ”

  • This command is used to switch from one iframe to another iframe.

3. Handling Alerts – ” driver.switchTo().alert() ”

  • This command is used to handle alerts.

4. Close Command –  close() 

  • This command closes the current window of the browser.

5. Quit Command – quit() 

  • This command is used to quit the browser and all the opened windows in the browser.

Selenium WebDriver Browser Commands PART - 1

 package selenium;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Browsercommands {
@SuppressWarnings("deprecation")
          public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver","C:\\Selenium\\chromedriver\\chromedriver.exe");
         
//Initialize WebDriver
WebDriver driver = new ChromeDriver();

// Wait For the Page To Load
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

// Go to URL
driver.get("https://suriyaparithy.blogspot.com/");

// Maximize Window
driver.manage().window().maximize();

// Storing Title name in String variable so that we can get the title name
String title = driver.getTitle();

// Printing the Title name in 2 ways
// 1st way
System.out.println(title);

// 2nd way
System.out.println("Title is : " + title);

// Storing Title length in Int variable because we are dealing with Integers that's why int is used.
int TitleLength = driver.getTitle().length();

// Printing Title length
System.out.println("Length of the Title is : " + TitleLength);

// Storing URL in String variable
String curl = driver.getCurrentUrl();

// Printing URL on Console Window
  System.out.println("URL is : " + curl);

// Storing URL length
int curl2 = driver.getCurrentUrl().length();

// Printing URL length on console Window
  System.out.println("URL length is : " + curl2);

 // COMMAND FOR NAVIGATION THROUGH PAGES.
//Open the TCA Page
   String tca =  driver.findElement(By.linkText("TCA")).getText();        
      
 // Print the Tab name which is being clicked.
   System. out.println("Name of the Tab which is being clicked is: " + tca);

  // Click on the TCA Tab
   driver.findElement(By.linkText("TCA")).click();

  //Navigate to the previous Page.
      driver.navigate().back();
      Thread.sleep(1000);
      String pre = driver.getTitle();

    // Print the text of the previous page
        System.out.println("Text of the previous page is : " + pre);

     //Navigate to the Next page.
         driver.navigate().forward();
     Thread.sleep(1000);

   // Print the text of the NEXT page
         String next = driver.getTitle();
 System.out.println("Text of the NEXT page is : " + next);

    // COMMAND FOR REFRESHING THE CURRENT PAGE
         driver.navigate().refresh();

    // PAGE SOURCE COMMAND
         
  /* Storing Page Source in String variable.
           String source = driver.getPageSource();
           Thread.sleep(1000);

        // Printing the Page Source
           System.out.println("Page source : " + source);

        // Storing Page Source length in Int variable
           int sou = driver.getPageSource().length();

         // Printing the Page Source length
           System.out.println("Length of the page source is : " + sou);*/

         //close the browser or page currently which is having the focus.
           driver.close();

          //Close all the windows.
         driver.quit();
}
}

Tuesday, March 29, 2022

Update Customer Credit Card API in Oracle Apps R12

DECLARE
   x_return_status     VARCHAR2 (1000);
   x_msg_count         NUMBER;
   x_msg_data          VARCHAR2 (4000);
   x_card_id           NUMBER;
   x_msg_data_out      VARCHAR2 (240);
   x_mesg              VARCHAR2 (240);
   x_count             NUMBER;
   x_response          iby_fndcpt_common_pub.result_rec_type;
   l_card_instrument   iby_fndcpt_setup_pub.creditcard_rec_type;
   v_context           VARCHAR2 (10);
   p_init_msg_list     varchar2(50);
   p_commit            varchar2(50);
   l_msg_index_out          NUMBER;
   l_error_message          VARCHAR2 (100);
BEGIN
     l_card_instrument.card_id          :='&card_id';                           
     l_card_instrument.expiration_date :=to_date('12/23/2018','mm/dd/yyyy');   
                   
     
     IBY_FNDCPT_SETUP_PUB.UPDATE_CARD
                       (p_api_version          => 1.0,
                        x_return_status        => x_return_status,
                        x_msg_count            => x_msg_count,
                        x_msg_data             => x_msg_data,
                        p_card_instrument      => l_card_instrument,
                        x_response             => x_response,
                        p_init_msg_list        => fnd_api.g_false,
                        p_commit               => fnd_api.g_true
                        );
        DBMS_OUTPUT.put_line ('output information');
        DBMS_OUTPUT.put_line ('x_msg_count = ' || x_msg_count);
        DBMS_OUTPUT.put_line ('x_return_status = ' || x_return_status);
     IF x_msg_count > 0 THEN
         FOR i IN 1 .. x_msg_count
         LOOP
            apps.fnd_msg_pub.get (p_msg_index          => i,
                                  p_encoded            => fnd_api.g_false,
                                  p_data               => x_msg_data,
                                  p_msg_index_out      => l_msg_index_out
                                 );
         END LOOP;

         IF l_error_message IS NULL
         THEN
            l_error_message := SUBSTR (x_msg_data, 1, 250);
         ELSE
            l_error_message :=
                       l_error_message || ' /' || SUBSTR (x_msg_data, 1, 250);
         END IF;

         DBMS_OUTPUT.put_line ('*****************************************');
         DBMS_OUTPUT.put_line ('API Error : ' || l_error_message);
         DBMS_OUTPUT.put_line ('*****************************************');
      END IF;
END;

Monday, August 30, 2021

Joining Multiple Tables in SQL: Best Practices and Techniques

SQL JOINS :
  •  Sometimes we have to combine the data from so many tables.
  •  A join combines the data spread across tables.
  •  A join is performed by the 'where' clause which combines the specified rows of tables.
  •  A common column provides the join condition.

Types of joins :
 There are three types of joins. They are
  1. Simple join or inner join
  2. Self join
  3. Outer Join

1. Inner join
  •   The most important and frequently used of the joins is the inner join.
  •   They are also referred to as EQUIJOIN.
  •   Inner join retrieve only the 'MATCHED RECORDS'.

Example :
  select e.employee_id,e.first_name,e.department_name,d.department_id
  from employees e, departments d
  where e.department_id = d.department_id;
  
 Non-equijoin
  •   A join that is based on relational operators other than = is called a non-Equi join.
Example :
  select a.item_id,item_name,stock,quantity
  from item_master a,sales_details b
  where(a.item_id=b.item_id)
  and (a.stock<b.quantity);

  This statement lists all items for which the stock in hand is less than the quantity ordered.

2. Outer Join
  •    The outer join extends the result of a simple join.
  •    An outer join returns all the rows from one table that do not match any row from the other table.
  •    The symbol + is used to represent the outer join.

 Left Outer Join
  •    All the records from the left side table and only the matched rows join from the right side table.

 Example :
   select e.employee_id,e.first_name,e.department_name,d.department_id
   from employees e, departments d
   where e.department_id = d.department_id(+);

 Right Outer Join
  •    All the records are from the right side table and only the matched rows left side table.

 Example :
   select e.employee_id,e.first_name,e.department_name,d.department_id
   from employees e, departments d
   where e.department_id(+) = d.department_id;

3. Self Join 
  •   Self-join is a regular join, but the table is joined with itself.

Saturday, August 28, 2021

The Complete Guide to Oracle Application R12 VIEWS

Database Objects in Oracle :

1. TABLE:  Used to store information & allows manipulation, retrieval & share of information.

 ( user_tables, user_tab_columns ,TAB )

2. VIEWS & SYNONYMS: Used to manipulate, retrieve &  share information. They will not hold data.
 ( user_views, user_synonyms, CAT )

3. SEQUENCES: Used to generate the numbers automatically. 
( user_sequences )

4. INDEX & CLUSTER: Used to improve the performance of Oracle while retrieving or manipulating data.
 ( user_indexes , user_clusters )

Views: 
 It is a stored select statement.
 It is a virtual or Logical component.
 It allows Desc, DML, and Select on it.
 It will not hold data.
 It is stored permanently in the "User_views" system table.
 It can be shared with other users.

 DML on view are reflected in Table and DML on   Table are reflected in the view.

 * It is used to share "Selected Rows and Columns"   with other users. It is used for reporting purposes.
 *It will Improve performance while manipulating or retrieving data from the Views.