https://cypress.io logo
Join Discord
Powered by
# help
  • i

    icy-dawn-47793

    11/22/2022, 9:01 AM
    I'm using selectFile() method to upload photo. But there is an issue, element locator that contains type="file" has a class hide. How can I access this locator. I tried invoke('show') already. Please help
  • f

    fresh-doctor-14925

    11/22/2022, 9:04 AM
    Doesn't
    selectFile
    have a
    force: true
    option? What does the error message say?
  • i

    icy-dawn-47793

    11/22/2022, 9:08 AM
    I'm using force : true aslo but still not working. Error I'm getting is : (uncaught expection) SecurityError : Block a frame with origin "http://localhost" from accessing a cross origin frame
  • f

    fresh-doctor-14925

    11/22/2022, 9:10 AM
    If you're running Chrome, try disabling web security https://docs.cypress.io/guides/guides/web-security#Disabling-Web-Security
  • f

    fresh-doctor-14925

    11/22/2022, 9:11 AM
    Otherwise you can catch the uncaught exception and stop the test from failing https://docs.cypress.io/api/events/catalog-of-events#Examples
  • i

    icy-dawn-47793

    11/22/2022, 9:17 AM
    When I try to disable web security and caught uncaught exception it gives me no error but still not uploading the photo
  • i

    icy-dawn-47793

    11/22/2022, 9:19 AM
    The issue i think is that the element locator I'm using it has a property of display none. When I try to use force: true it give me uncaught expectation error. When try to ignore this error then nothing happens
  • f

    fresh-doctor-14925

    11/22/2022, 9:26 AM
    If you're getting that input, then
    selectFile
    shouldn't be an issue. I'm out of suggestions. It would be helpful for you to share the code where you're getting the element and calling
    selectFile()
  • i

    icy-dawn-47793

    11/22/2022, 9:32 AM
    cy.get('[class~="FileUploader"] input[type="type"]').selectFile('file1.jpg', {force: true})
  • f

    fresh-doctor-14925

    11/22/2022, 9:43 AM
    Should be
    input[type="file"]
    , but it would be even better if you had a test id on there
  • i

    icy-dawn-47793

    11/22/2022, 9:44 AM
    Sorry that was typing error.
  • i

    icy-dawn-47793

    11/22/2022, 9:45 AM
    It is input[type="file"]
  • f

    fresh-doctor-14925

    11/22/2022, 9:46 AM
    In that case, you're doing everything right on the cypress side. I suggest you sit down with one of your app's developers to debug what's happening in the application
  • i

    icy-dawn-47793

    11/22/2022, 9:46 AM
    Alright. Thanks for responding and helping me out, appreciate it
  • f

    fresh-doctor-14925

    11/22/2022, 9:47 AM
    You're welcome. Good luck in figuring it out 🙂
  • f

    fierce-engine-20889

    11/22/2022, 1:42 PM
    Hey everyone, has anybody tried integrating v10 with Qase?
  • b

    brash-tiger-52405

    11/22/2022, 2:11 PM
    Hello everyone, the client id in the cypress.config.json file auth_client_id: 'cypress-test' changes in the url which cypress opens. Does anybody know, how i can solve this?
  • f

    full-pizza-42889

    11/22/2022, 2:22 PM
    hey all. is there a way to alias an element that doesn't exist yet?
  • g

    gray-kilobyte-89541

    11/22/2022, 2:41 PM
    why would you alias something that does not exist yet?
  • f

    full-pizza-42889

    11/22/2022, 2:41 PM
    so that i can have all my aliases in one place for ease of reference
  • f

    full-pizza-42889

    11/22/2022, 2:42 PM
    and since alias will requery for stale elements, i thought it would follow that you could perhaps somehow alias elements that don't exist yet, rather than just ones that do, but maybe won't in the future.
  • f

    full-pizza-42889

    11/22/2022, 2:52 PM
    in the case of some transient element with a complex selector, i'd rather not have the alias unexpectedly appear inside the usual test code, but i'd also rather not repeat the selector. i'd also rather not stick it in a closure or the selector in a variable as that would be inconsistent with everything else
  • f

    fresh-doctor-14925

    11/22/2022, 2:53 PM
    > transient element with a complex selector This sounds like a good use case for a test id
  • f

    full-pizza-42889

    11/22/2022, 2:54 PM
    perhaps the test id is complex because it's one of many in many dimensions 😛
  • f

    full-pizza-42889

    11/22/2022, 2:54 PM
    anyway, sounds like the answer to my question is "no" 😛
  • f

    fresh-doctor-14925

    11/22/2022, 2:56 PM
    I think so, yeah.
    get()
    will fail if there isn't anything there, so it wouldn't be possible to have an element yielded to the
    as
    Best alternative I can think of is to define your (needlessly? :P) complex test ids in variables, then pass them to
    cy.get()
    when needed
  • f

    full-pizza-42889

    11/22/2022, 2:57 PM
    yeah, that seems to be the case
  • f

    full-pizza-42889

    11/22/2022, 2:58 PM
    another case is where i need some deeply nested element within the transient that i just don't have control over and can't give a
    data-cy
    😛
  • f

    full-pizza-42889

    11/22/2022, 2:58 PM
    anyway, thanks liam
  • f

    fresh-doctor-14925

    11/22/2022, 2:59 PM
    Got to love those cases 🙂 Best of luck finding a solution, sorry the placeholder alias approach isn't doable
1...210211212...252Latest