MDL-68353 test: Update filemanager/filepicker xpath selector
[moodle.git] / lib / behat / core_behat_file_helper.php
index 957a357..b4064ef 100644 (file)
@@ -74,7 +74,7 @@ trait core_behat_file_helper {
             $filepickerelement = behat_context_helper::escape($filepickerelement);
             $filepickercontainer = $this->find(
                     'xpath',
-                    "//input[./@id = //label[normalize-space(.)=$filepickerelement]/@for]" .
+                    "//input[./@id = substring-before(//p[normalize-space(.)=$filepickerelement]/@id, '_label')]" .
                     "//ancestor::*[@data-fieldtype = 'filemanager' or @data-fieldtype = 'filepicker']",
                     $exception
             );