Forráskód Böngészése

implement selenium ide select (#273)

Tetsuya Tatsumi 9 éve
szülő
commit
78aad2e016
1 módosított fájl, 13 hozzáadás és 0 törlés
  1. 13 0
      ide-plugin.js

+ 13 - 0
ide-plugin.js

@@ -366,6 +366,19 @@ WDAPI.Element.prototype.isSelected = function() {
   return this.ref + "->is_selected";
 };
 
+WDAPI.Element.prototype.select = function(selectLocator) {
+  if (selectLocator.type == 'index') { 
+    return "$driver->find_child_element(" + this.ref + 
+    ", \"//option[" +  selectLocator.string + "]\" , \"xpath\")->click";
+  } 
+  if (selectLocator.type == 'value') { 
+    return "$driver->find_child_element(" + this.ref + 
+    ", \"//*[\\@value='" + selectLocator.string+ "']\" , \"xpath\")->click";
+  } 
+  return "$driver->find_child_element(" + this.ref + 
+  ", \"//*[text()='" + selectLocator.string+ "']\" , \"xpath\")->click";
+};
+
 WDAPI.Element.prototype.sendKeys = function(text) {
   return this.ref + "->send_keys(" + xlateArgument(text) + ")";
 };