<commit_before><?php

namespace services\google\translator\PageObjects;

use lib\ServicePageObject;

class GoogleTranslatorPageObject extends ServicePageObject
{
  
  public function selectLanguageFrom()
  {
  }
  
  public function selectLanguageTo()
  {
  }
  
  public function clickTranslateButton()
  {
    $this->webdriver
      ->findElement(WebDriverBy::id("gt-submit"))
      ->click();
      
    return $this;
  }
  
  public function getTranslation()
  {
  }
  
  public function clickSwitchLanguageButton()
  {
  }
  
  public function clearTranslateFromTextarea()
  {
  }
}<commit_msg>- [gt] selecting languages actions<commit_after><?php

namespace services\google\translator\PageObjects;

use lib\ServicePageObject;

class GoogleTranslatorPageObject extends ServicePageObject
{
  public function selectLanguageFrom($language)
  {
    $this->selectFromDropDownMenu(
      WebDriverBy::id("gt-sl-gms"),
      WebDriverBy::xpathSelector(
        "//div[@id='gt-sl-gms-menu']//div[@class='goog-menuitem-content' and contains(text(), '".$language."')]"
      )
    );
  }
  
  public function selectLanguageTo()
  {
    $this->selectFromDropDownMenu(
      WebDriverBy::id("gt-tl-gms"),
      WebDriverBy::xpathSelector(
        "//div[@id='gt-tl-gms-menu']//div[@class='goog-menuitem-content' and contains(text(), '".$language."')]"
      )
    );
  }
  
  public function clickTranslateButton()
  {
    $this->webdriver
      ->findElement(WebDriverBy::id("gt-submit"))
      ->click();
      
    return $this;
  }
  
  public function getTranslation()
  {
  }
  
  public function clickSwitchLanguageButton()
  {
  }
  
  public function clearTranslateFromTextarea()
  {
  }
  
  protected function selectFromDropDownMenu($menuSelector, $elementSelector)
  {
    $this->webdriver
      ->findElement($menuSelector)
      ->click();
    
    $this->webdriver
      ->findElement($elementSelector))
      ->click();
  }
}
{'fraction_non_alphanumeric': 0.13547052740434332, 'fraction_numerical': 0.0, 'mean_word_length': 3.2527472527472527, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1116872', 'n_tokens_mistral': 614, 'n_tokens_neox': 611, 'n_words': 92}